HDOJ 5099 Comparison of Android versions 坑题
来源:互联网 发布:tensorflow fcn 微调 编辑:程序博客网 时间:2024/06/06 09:27
现场赛的时候错了十四次。。。。。
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.
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.
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.
● 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
2FRF85B EPF21BKTU84L KTU84M
Sample Output
Case 1: > >Case 2: = <
Source
2014上海全国邀请赛——题目重现(感谢上海大学提供题目)
#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;}
0 0
- HDOJ 5099 Comparison of Android versions 坑题
- hdoj-5099-Comparison of Android versions
- HDOJ 5099 Comparison of Android versions(字符串模拟)
- Comparison of Android versions
- 【瞎搞】 HDU 5099 Comparison of Android versions
- hdu 5099 Comparison of Android versions(水题)
- HDU 5099 Comparison of Android versions
- HDU 5099 - Comparison of Android versions
- hdu 5099 Comparison of Android versions
- hdoj.5099 Comparison of Android versions【字符串处理,水题】 2015/08/13
- HDU 5099 Comparison of Android versions(字符串)
- HDU 5099 Comparison of Android versions(模拟-水题)
- HDU 5099 Comparison of Android versions(模拟)
- HDU 5099 Comparison of Android versions(坑水题)
- HDU 5099 Comparison of Android versions【字符串+模拟】
- HDU 5099 Comparison of Android versions(上海邀请赛模拟水题)
- Comparison of Android versions(2014上海全国邀请赛)
- hdu 5199 Comparison of Android version
- [c] 单链表创建,打印和反转
- log4j配置springMvc例子
- Apache的工作模式和最大并发请求数设置
- 免费JSON格式的服务接口
- 源码分析使用Cocos2d-x实现2D光线效果
- HDOJ 5099 Comparison of Android versions 坑题
- 第十周项目一(3)
- tn air max 2014 pas cher so the surgery begins."We picked up the small latitude mother 140 grams of
- christian louboutin pas cher after running away from home 29 hours
- rac2fs脚本
- scarpe hogan but also attracted a large number of stars
- SQL Server 日期格式转换
- hollister driver's license
- ios手势识别(双击、捏、旋转、拖动、划动、长按, 上下左右滑动)