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

。。。

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;
}

HDOJ 5099 Comparison of Android versions 坑题的更多相关文章

  1. 模拟 HDOJ 5099 Comparison of Android versions

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

  2. HDU5099——Comparison of Android versions(简单题)(2014上海邀请赛重现)

    Comparison of Android versionsProblem DescriptionAs an Android developer, itˇs really not easy to fi ...

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

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

  4. hdoj-5099-Comparison of Android versions

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

  5. Android开发如何准备技术面试(含Android面试押题)

    今年毋庸置疑是找工作的寒冬,每一个出来找工作的同学都是值得尊敬的.现在找工作,虽然略难,但是反过来看也会逼迫我们成为更加优秀的自己. 但是不管是旺季还是寒冬,有一些优秀的同学找工作还是挺顺利的.所以说 ...

  6. Android测试基础题(三)

    今天接着给大家带来的是Android测试基础题(三).    需求:定义一个排序的方法,根据用户传入的double类型数组进行排序,并返回排序后的数组 俗话说的好:温故而知新,可以为师矣 packag ...

  7. 【BZOJ-1952】城市规划 [坑题] 仙人掌DP + 最大点权独立集(改)

    1952: [Sdoi2010]城市规划 Time Limit: 10 Sec  Memory Limit: 128 MBSubmit: 73  Solved: 23[Submit][Status][ ...

  8. hdu 5455 Fang Fang 坑题

    Fang Fang Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=5455 ...

  9. String类面试坑题

    1.面试坑题F:\SHJT\JavaWorkspace\JavaSE\workspace\day13ezra\src\cn\itcast\sh\classcode\BTStringLastIndexO ...

随机推荐

  1. cdev_init和register_chrdev区别

    --- 01:include/linux/fs.h static inline int register_chrdev(unsigned int major, const char *name, co ...

  2. Windows 文件自动同步共享工具

    操作地址: http://blog.sina.com.cn/s/blog_1320088ed0102uxln.html下载地址: http://www.zisync.com/download

  3. week1 notebook1

    初识Python 一.python介绍 - 解释器: cpython(默认使用) ipython(shell) jpython(java) ironpython rubypython - 编码: as ...

  4. CUDA与OpenCL架构

    CUDA与OpenCL架构 目录 CUDA与OpenCL架构 目录 1 GPU的体系结构 1.1 GPU简介 1.2 GPU与CPU的差异 2 CUDA架构 2.1 硬件架构 2.1.1 GPU困境 ...

  5. windows server 2008 不能执行bat

    服务器有一个bat脚本,需要自动或手工执行,之前一直运行OK,可是突然有一天自动或手动都不能执行了,查了半天,原来是因为另一个运维人把环境变量中path的值改了,%SystemRoot%\system ...

  6. django 安装运行

    pip install django pip list 查看版本 python -m django --version 新建django django-admin startproject mysit ...

  7. Ext未定义问题解决

    做的项目用到EXT.NET,调试时候没问题,发布到IIS上出现EXT未定义,把项目的应用程序池改为Classic 模式就可以了.

  8. 解决strip: Unable to recognise the format of the input file问题

    前言   在编译xilinx的uboot的时候出现了一个问题,始终报错:“strip: Unable to recognise the format of the input file `gen_et ...

  9. (转)RabbitMQ学习之spring整合发送异步消息(注解实现)

    http://blog.csdn.net/zhu_tianwei/article/details/40919249 实现使用Exchange类型为DirectExchange. routingkey的 ...

  10. js FormData 的使用

    <div> <input type="file" name="filename" multiple="multiple" ...