2014上海全国邀请赛 j 题!!
来源:互联网 发布:网易云请确保网络连接 编辑:程序博客网 时间:2024/05/16 10:42
Comparison of Android versions
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 0 Accepted Submission(s): 0
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
2FRF85B EPF21BKTU84L KTU84M
Sample Output
Case 1: > >Case 2: = <
看完题目我才发现英语是多么的重要!!!!!!
以后好好学英语~~~~(>_<)~~~~
题意:比较版本发行的大小和时间的大小;
思路:比较版本时就比较第一个字母就ok了;
比较时间时还要判断是否是in the same code branch (就是看第二个字母是否相同);之前看的时候差点晕死了:-(
相同就多比较最后一个字母,不相同就不比较最后一个字母;
很奇怪是吧,好像这场比赛题目都这么奇怪:-O
AC代码(写的比较挫。。):
#include <cstdio>#include <cstring>#include <iostream>#include <algorithm>using namespace std;int main(){char str1[10], str2[10], ans1, ans2;int T;scanf("%d", &T);for(int k=1; k<=T; k++){int a, b;char s1[10], s2[10];scanf("%s %s", str1, str2);if(str1[0]>str2[0]) ans1='>';else if(str1[0]==str2[0]) ans1='=';else if(str1[0]<str2[0]) ans1='<';sscanf(str1+3, "%d", &a); sscanf(str2+3, "%d", &b);if(str1[2]>str2[2]) ans2='>';else if(str1[2]<str2[2]) ans2='<';else if(str1[2]==str2[2]) {if(a>b)ans2='>';else if(a<b)ans2='<';else if(a==b && str1[1]!=str2[1]) ans2='=';else if(a==b && str1[1]==str2[1]){if(str1[5]>str2[5]) ans2='>';else if(str1[5]<str2[5]) ans2='<';else if(str1[5]==str2[5]) ans2='=';}}printf("Case %d: %c %c\n", k, ans1, ans2);}return 0;}
1 0
- 2014上海全国邀请赛 j 题!!
- 2014上海全国邀请赛Maze
- 2014上海全国邀请赛1001(hdu 5090)
- 2014上海全国邀请赛1003(hdu 5092)
- 2014上海全国邀请赛1006(hdu 5095)
- 2014上海全国邀请赛1010(hdu 5099)
- 2014上海全国邀请赛 解题报告
- 2014上海全国邀请赛 【(5+3)/10】
- 2015上海邀请赛J题 Joyful
- 2014上海全国邀请赛I题 Smart Software Installer(hdu5098)(top排序)
- 2014上海全国邀请赛题解 HDOJ 5090-5099
- Comparison of Android versions(2014上海全国邀请赛)
- SDKD TeamContest F(2014上海全国邀请赛)
- 2014上海全国邀请赛——题目重现 4.24
- 2014上海全国邀请赛训练总结【7/10】
- 【HDU】2014上海全国邀请赛——题目重现(感谢上海大学提供题目) 题解
- 2014ACM上海邀请赛A题题解
- HDU 4584Shaolin2012杭州全国邀请赛J题(暴力或set 两种做法)
- javascript 制作时间显示器代码
- ArchLinux安装笔记
- C#高级编程学习笔记(一)---C#核心
- linux命令的别名alias,unalias
- RakNet学习(11) -- Creating Packets
- 2014上海全国邀请赛 j 题!!
- 洗牌问题
- RakNet学习(12) -- Send Packets
- 浅说单态类
- ios 沙盒和常见的数据存储方式。
- 第十周项目一 程序的填充与阅读1
- PreTranslateMessage 、CWND & HWND & 控件ID之间的巧妙转换方法
- 课堂内容听得懂,敲不出代码怎么办?
- 2014年11月2日 平常的日子 伟大的决定