HDU5099——Comparison of Android versions(简单题)(2014上海邀请赛重现)
Comparison of Android versions
Problem Description
As an Android developer, itˇs really not easy to figure out a newer version of two kernels, because Android is updated so frequently and has many branches. Fortunately, Google identifies individual builds with a short build code, e.g. FRF85B.
The first letter is the code name of the release family, e.g. F is Froyo. The code names are ordered alphabetically. The latest code name is K (KitKat).
The second letter is a branch code that allows Google to identify the exact code branch that the build was made from, and R is by convention the primary release branch.
The next letter and two digits are a date code. The letter counts quarters, with A being Q1 2009. Therefore, F is Q2 2010. The two digits count days within the quarter, so F85 is June 24 2010.
Finally, the last letter identifies individual versions related to the same date code, sequentially starting with A; A is actually implicit and usually omitted for brevity.
Please develop a program to compare two Android build numbers.
Input
The first line is an integer n (1 <= n <= 2000), which indicates how many test cases need to process.
Each test case consists of a single line containing two build numbers, separated by a space character.
Output
For each test case, output a single line starting with ¨Case #: 〃 (# means the number of the test case). Then, output the result of release comparison as follows:
● Print "<" if the release of the first build number is lower than the second one;
● Print "=" if the release of the first build number is same as he second one;
● Print ">" if the release of the first build number is higher than the second one.
Continue to output the result of date comparison as follows:
● Print "<" if the date of the first build number is lower than the second one;
● Print "=" if the date of the first build number is same as he second one;
● Print ">" if the date of the first build number is higher than the second one.
If two builds are not in the same code branch, just compare the date code; if they are in the same code branch, compare the date code together with the individual version.
Sample Input
2
FRF85B EPF21B
KTU84L KTU84M
Sample Output
Case 1: > >
Case 2: = <
题目大意&解题思路:
1、比较两个字符串的第一个字母的大小.
2、如果两个字符串的第二个字母不同就比较接下来的三个字母的大小.
如果两个字符串的第二个字母相同就比较剩余的四个字母.
PS:英语好读懂题就不难。TT
Code:
/*************************************************************************
> File Name: shanghai_1010.cpp
> Author: Enumz
> Mail: 369372123@qq.com
> Created Time: 2014年11月02日 星期日 13时43分08秒
************************************************************************/ #include<iostream>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<cstring>
#include<list>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<algorithm>
#include<cmath>
#include<bitset>
#include<climits>
#define MAXN 100000
using namespace std;
char str1[],str2[];
int main()
{
int T;
cin>>T;
int times=;
while (T--)
{
cin>>str1>>str2;
printf("Case %d:",times++);
char tmp1[]={},tmp2[]={};
tmp1[]=str1[];
tmp2[]=str2[];
if (strcmp(tmp1,tmp2)>)
printf(" >");
else if (strcmp(tmp1,tmp2)<)
printf(" <");
else printf(" =");
tmp1[]=str1[];
tmp2[]=str2[];
if (strcmp(tmp2,tmp1)!=)
{
str1[]=,str2[]=;
if (strcmp(str1+,str2+)>)
printf(" >\n");
else if( strcmp(str1+,str2+)<)
printf(" <\n");
else
printf(" =\n");
}
else
{
if (strcmp(str1+,str2+)>)
printf(" >\n");
else if (strcmp(str1+,str2+)<)
printf(" <\n");
else
printf(" =\n");
}
}
return ;
}
HDU5099——Comparison of Android versions(简单题)(2014上海邀请赛重现)的更多相关文章
- HDOJ 5099 Comparison of Android versions 坑题
现场赛的时候错了十四次. . ... Comparison of Android versions Time Limit: 2000/1000 MS (Java/Others) Memory L ...
- HDU5092——Seam Carving(动态规划+回溯)(2014上海邀请赛重现)
Seam Carving DescriptionFish likes to take photo with his friends. Several days ago, he found that s ...
- HDU5093——Battle ships(最大二分匹配)(2014上海邀请赛重现)
Battle ships Problem DescriptionDear contestant, now you are an excellent navy commander, who is res ...
- HDU5090——Game with Pearls(匈牙利算法|贪心)(2014上海邀请赛重现)
Game with Pearls Problem DescriptionTom and Jerry are playing a game with tubes and pearls. The rule ...
- 模拟 HDOJ 5099 Comparison of Android versions
题目传送门 /* 题意:比较型号的大小 模拟:坑点在长度可能为5,此时设为'A' */ #include <cstdio> #include <algorithm> #incl ...
- Comparison of Android versions(strcmp的应用)
Description As an Android developer, itˇs really not easy to figure out a newer version of two kerne ...
- hdoj-5099-Comparison of Android versions
Comparison of Android versions Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (J ...
- MCM试题原文及翻译 AB题 2014美国数学建模竞赛
MCM试题原文及翻译 AB题 2014美国数学建模竞赛 原创翻译,如有瑕疵,敬请谅解. 转载请注明:过客小站 » MCM试题原文及翻译 AB题 2014美国数学建模竞赛 PROBLEM A: The ...
- NYOJ 821 简单求值【简单题】
/* 解题人:lingnichong 解题时间:2014.10.18 00:46 解题体会:简单题 */ 简单求值 时间限制:1000 ms | 内存限制:65535 KB 难度:1 描写叙述 ...
随机推荐
- HTTP 错误 404.3 - Not Found
在使用win2012服务器上的IIS发布网页的时候,出现下面的错误 解决办法: 将应用程序开发下的所有功能都安装. 如果上面的方法没解决问题的话,那么看看下图中的这些安装没,没有的话就继续安装.
- Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space解决方法 问题描述 Exception ...
- JVM基础:深入学习JVM堆与JVM栈
转自:http://developer.51cto.com/art/201009/227812.htm JVM栈解决程序的运行问题,即程序如何执行,或者说如何处理数据;JVM堆解决的是数据存储的问题, ...
- 如何在LINUX VPS上安装VPN详细步骤
在vps上安装vpn是个难点,很多朋友都不会,这儿结合一位朋友的安装经验做下介绍.注意你的vps要安装做vpn使用,一定要注意你的流量限制,使用Vpn上游戏上youtube看视频等都比较耗费资源,否则 ...
- <亲测好使>mac os 安装mcrypt扩展
以前安装opencart的时候倒是不需要mcrypt 这个库.但是新版本需要了.加上自己的 是mac环境.当时闲麻烦,就一直没装.这次下午就寻思给装上吧! 1.首先你要先安装xcode这个工具.不然没 ...
- iTween基础之Look(使对象面朝指定位置)
一.基础介绍:二.基础属性 原文地址:http://blog.csdn.net/dingkun520wy/article/details/50578142 一.基础介绍 LookTo:旋转游戏对象使其 ...
- OC中的点语法,成员变量的作用域
点语法 点语法本质是函数的调用,不是像java中那样,是用来访问成员变量的:oc中访问成员变量是用 -> 访问的: Person *p = [Person new]; p.age = 10; / ...
- ADT eclipse打开时出现Error: Error parsing C:\Users\admin*\.android\devices.xml
Error: Error parsing C:\Users\admin*\.android\devices.xml 在ADT eclipse打开项目的时候出现此提示,但是又不影响使用. 原因:之前安 ...
- C# book
<编写高质量代码:改善C#程序的157个建议>源码下载 http://www.cnblogs.com/luminji/archive/2011/09/20/2182265.html < ...
- CI_Autocomplete_2.0.php轻松实现Bebeans与Codeigniter的智能提示
在你的NetBeans项目下建立一个CI_Autocomplete_2.0.php的文件,粘贴以下代码:(codeigniter太旧了,其实性能不行,应该没人更了,换了吧,别学这玩意了,坑人) < ...