现场赛的时候错了十四次。

。。。

Comparison of Android versions

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)

Total Submission(s): 76    Accepted Submission(s): 60

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: = <
 
Source
 

#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm> using namespace std; char s1[10],s2[10];
char ONE,TWO; void BJ1()
{
if(s1[0]<s2[0]) ONE='<';
else if(s1[0]==s2[0]) ONE='=';
else ONE='>';
} void BJ2()
{
if(s1[2]<s2[2]) TWO='<';
else if(s1[2]==s2[2])
{
int day1=(s1[3]-'0')*10+s1[4]-'0';
int day2=(s2[3]-'0')*10+s2[4]-'0';
if(day1<day2) TWO='<';
else if(day1==day2)
{
if(s1[1]==s2[1])
{
if(s1[5]<s2[5]) TWO='<';
else if(s1[5]==s2[5]) TWO='=';
else TWO='>';
}
else TWO='=';
}
else TWO='>';
}
else TWO='>';
} int main()
{
int T_T;
int cas=1;
scanf("%d",&T_T);
while(T_T--)
{
scanf("%s%s",s1,s2);
if(strlen(s1)<6) s1[5]='A';
if(strlen(s2)<6) s2[5]='A';
BJ1();BJ2();
printf("Case %d: %c %c\n",cas++,ONE,TWO);
}
return 0;
}

最新文章

  1. docker进入后台运行的容器
  2. 使用delphi+intraweb进行微信开发4—微信消息加解密
  3. Java - Collection 高效的找出两个List中的不同元素
  4. solr-tomcat 中文乱码
  5. devi into python 笔记(二)元组 变量声明 和列表解析
  6. java.sql.Date to java.util.Date
  7. cocos2d与cocos2d-X中的draw和update
  8. git 工具
  9. 转-SecureCRT设置
  10. 【PAT】1035. Password (20)
  11. ZOJ 1859 Matrix Searching(二维线段树)
  12. Oracle 11g RAC 修改各类IP地址
  13. js 本月,下一月,上一月
  14. 负载均衡集群企业级应用实战—LVS
  15. c语言博客作业--结构体&amp;文件
  16. C# List去重的三种方法(转)
  17. 20165312 2017-2018-2 《JAVA程序设计》第6周学习总结
  18. CodeSmith的基础模版类(CodeSmith help中的内容)
  19. JAVA 传递
  20. 关于云计算基础架构IaaS层的几点看法

热门文章

  1. DecimalFormat格式化输出带小数的数字类型
  2. SpringMVC 拦截器不拦截静态资源的三种处理方式方法
  3. c15--二位数组
  4. 【撸码caffe 三】 caffe.cpp
  5. [POJ 1639] Picnic Planning
  6. linux 标准输出和后台运行
  7. 在Mac OSX上安装ffmpeg &amp;&amp; ffmpeg命令行将h264封装为mp4
  8. 洛谷P4413 [COCI2006-2007#2] R2(可持久化平衡树维护NTT)
  9. video相关简单的api
  10. js-字符串方法