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:

  1. /*************************************************************************
  2. > File Name: shanghai_1010.cpp
  3. > Author: Enumz
  4. > Mail: 369372123@qq.com
  5. > Created Time: 2014年11月02日 星期日 13时43分08秒
  6. ************************************************************************/
  7.  
  8. #include<iostream>
  9. #include<cstdio>
  10. #include<cstdlib>
  11. #include<string>
  12. #include<cstring>
  13. #include<list>
  14. #include<queue>
  15. #include<stack>
  16. #include<map>
  17. #include<set>
  18. #include<algorithm>
  19. #include<cmath>
  20. #include<bitset>
  21. #include<climits>
  22. #define MAXN 100000
  23. using namespace std;
  24. char str1[],str2[];
  25. int main()
  26. {
  27. int T;
  28. cin>>T;
  29. int times=;
  30. while (T--)
  31. {
  32. cin>>str1>>str2;
  33. printf("Case %d:",times++);
  34. char tmp1[]={},tmp2[]={};
  35. tmp1[]=str1[];
  36. tmp2[]=str2[];
  37. if (strcmp(tmp1,tmp2)>)
  38. printf(" >");
  39. else if (strcmp(tmp1,tmp2)<)
  40. printf(" <");
  41. else printf(" =");
  42. tmp1[]=str1[];
  43. tmp2[]=str2[];
  44. if (strcmp(tmp2,tmp1)!=)
  45. {
  46. str1[]=,str2[]=;
  47. if (strcmp(str1+,str2+)>)
  48. printf(" >\n");
  49. else if( strcmp(str1+,str2+)<)
  50. printf(" <\n");
  51. else
  52. printf(" =\n");
  53. }
  54. else
  55. {
  56. if (strcmp(str1+,str2+)>)
  57. printf(" >\n");
  58. else if (strcmp(str1+,str2+)<)
  59. printf(" <\n");
  60. else
  61. printf(" =\n");
  62. }
  63. }
  64. return ;
  65. }

HDU5099——Comparison of Android versions(简单题)(2014上海邀请赛重现)的更多相关文章

  1. HDOJ 5099 Comparison of Android versions 坑题

    现场赛的时候错了十四次. . ... Comparison of Android versions Time Limit: 2000/1000 MS (Java/Others)    Memory L ...

  2. HDU5092——Seam Carving(动态规划+回溯)(2014上海邀请赛重现)

    Seam Carving DescriptionFish likes to take photo with his friends. Several days ago, he found that s ...

  3. HDU5093——Battle ships(最大二分匹配)(2014上海邀请赛重现)

    Battle ships Problem DescriptionDear contestant, now you are an excellent navy commander, who is res ...

  4. HDU5090——Game with Pearls(匈牙利算法|贪心)(2014上海邀请赛重现)

    Game with Pearls Problem DescriptionTom and Jerry are playing a game with tubes and pearls. The rule ...

  5. 模拟 HDOJ 5099 Comparison of Android versions

    题目传送门 /* 题意:比较型号的大小 模拟:坑点在长度可能为5,此时设为'A' */ #include <cstdio> #include <algorithm> #incl ...

  6. Comparison of Android versions(strcmp的应用)

    Description As an Android developer, itˇs really not easy to figure out a newer version of two kerne ...

  7. hdoj-5099-Comparison of Android versions

    Comparison of Android versions Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (J ...

  8. MCM试题原文及翻译 AB题 2014美国数学建模竞赛

    MCM试题原文及翻译 AB题 2014美国数学建模竞赛 原创翻译,如有瑕疵,敬请谅解. 转载请注明:过客小站 » MCM试题原文及翻译 AB题 2014美国数学建模竞赛 PROBLEM A: The  ...

  9. NYOJ 821 简单求值【简单题】

    /* 解题人:lingnichong 解题时间:2014.10.18   00:46 解题体会:简单题 */ 简单求值 时间限制:1000 ms  |  内存限制:65535 KB 难度:1 描写叙述 ...

随机推荐

  1. nginx+keepalived双主高可用负载均衡

    实验环境及软件版本:CentOS版本: 6.6(2.6.32.-504.el6.x86_64)nginx版本: nginx-1.6.3keepalived版本:keepalived-1.2.7 主LB ...

  2. gcc链接程序时出现undefined reference to""错误

    如:: undefined reference to ‘mq_unlink',意思是指函数mq_unlink没有定义. 可以使用如下步骤找到该函数所在的库: 1).查找哪些库包含了或使用了该函数:gr ...

  3. python 字典内置方法get应用

    python字典内置方法get应用,如果我们需要获取字典值的话,我们有两种方法,一个是通过dict['key'],另外一个就是dict.get()方法. 今天给大家分享的就是字典的get()方法. 这 ...

  4. oracle中的记录类型

    单词RECORD有“记录”的意思,因此RECORD也称为“记录类型”,使用该类型的变量可以存储由多个列值组成的一行数据. 在声明记录类型变量之前,首先需要定义记录类型,然后才可以声明记录类型的变量. ...

  5. VS2010性能监视工具

    <编程珠玑(续)>第一章中就介绍了性能监视工具,对于较简单的程序来说,性能监视工具其实可以用变量累加来计算的,但是对于较复杂的程序来说就需要比较好的性能监视工具了.而VS2010提供了一个 ...

  6. php的public、protected、private三种访问控制模式的区别

    public: 公有类型 在子类中可以通过self::var调用public方法或属性,parent::method调用父类方法 在实例中可以能过$obj->var 来调用 public类型的方 ...

  7. 一些牛逼的统计SQL

    SQL 1.查询连续2天,每天发帖大于等于2次的用户 SELECT USER_ID FROM ( SELECT USER_ID, DATEDIFF(CREATE_TIME, '1971-01-01') ...

  8. UDP TCP 消息边界

    先明确一个问题,如果定义了一个数据结构,大小是,比方说 32 个字节,然后 UDP 客户端连续向服务端发了两个包.现在假设这两个包都已经到达了服务器,那么服务端调用 recvfrom 来接收数据,并且 ...

  9. NGUI List<EventDelegate> 小坑

    NGUI 3.0 之后 采用了 一种 全新的 事件系统 List<EventDelegate> ,使用起来并不麻烦. 但是最近做项目碰到一个小问题,特此分享一下. PS NGUI3.6.4 ...

  10. Unity3D脚本中文系列教程(一)

    原地址:http://dong2008hong.blog.163.com/blog/static/46968827201403115643431/?suggestedreading&wumii ...