HDOJ 5099 Comparison of Android versions 坑题
现场赛的时候错了十四次。
。
。。。
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
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.
Each test case consists of a single line containing two build numbers, separated by a space character.
● 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.
2
FRF85B EPF21B
KTU84L KTU84M
Case 1: > >
Case 2: = <
#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 坑题的更多相关文章
- 模拟 HDOJ 5099 Comparison of Android versions
题目传送门 /* 题意:比较型号的大小 模拟:坑点在长度可能为5,此时设为'A' */ #include <cstdio> #include <algorithm> #incl ...
- HDU5099——Comparison of Android versions(简单题)(2014上海邀请赛重现)
Comparison of Android versionsProblem DescriptionAs an Android developer, itˇs really not easy to fi ...
- Comparison of Android versions(strcmp的应用)
Description As an Android developer, itˇs really not easy to figure out a newer version of two kerne ...
- hdoj-5099-Comparison of Android versions
Comparison of Android versions Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (J ...
- Android开发如何准备技术面试(含Android面试押题)
今年毋庸置疑是找工作的寒冬,每一个出来找工作的同学都是值得尊敬的.现在找工作,虽然略难,但是反过来看也会逼迫我们成为更加优秀的自己. 但是不管是旺季还是寒冬,有一些优秀的同学找工作还是挺顺利的.所以说 ...
- Android测试基础题(三)
今天接着给大家带来的是Android测试基础题(三). 需求:定义一个排序的方法,根据用户传入的double类型数组进行排序,并返回排序后的数组 俗话说的好:温故而知新,可以为师矣 packag ...
- 【BZOJ-1952】城市规划 [坑题] 仙人掌DP + 最大点权独立集(改)
1952: [Sdoi2010]城市规划 Time Limit: 10 Sec Memory Limit: 128 MBSubmit: 73 Solved: 23[Submit][Status][ ...
- hdu 5455 Fang Fang 坑题
Fang Fang Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=5455 ...
- String类面试坑题
1.面试坑题F:\SHJT\JavaWorkspace\JavaSE\workspace\day13ezra\src\cn\itcast\sh\classcode\BTStringLastIndexO ...
随机推荐
- Linux安装sshfs挂载远程目录到本地及卸载
挂载远程目录的方式很多,这里把sshfs记录一下备忘.Linux用sshfs挂载远程目录到本地 安装sshfs 在Ubuntu下,只需要使用 $ sudo apt-get install sshfs ...
- hdoj--2063--过山车(最大匹配)
过山车 Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submis ...
- linux git保存用户名密码(避免每次push输用户名密码)
Linux/Unix/Mac 系统 新建一个 ~/.netrc 文件, 将 git 服务器, 用户名以及密码记录在这个文件, 如下所示: machine your-git-server log ...
- 配置win2008防火墙 允许被Ping的设置方法
出于安全因素考虑,在 Windows Server 2008 上是不允许从外部对其执行 Ping 指令的 如果要配置允许被 Ping 通过以往的设置步骤会发现并不能从 Windows firewall ...
- js设计模式-命令模式
命令模式是一种组织型模式,主要用在把调用对象(用户界面.API和代理等)与实现操作的对象隔离开.也就是说 ,凡是两个对象间的互动方式需要更高的模块化程度时都可以用到这种模式. 命令模式的好处:1.提高 ...
- CI中的url相关函数以及路由设置和伪静态技术
当使用CI框架进行开发时,我们的一些数据传递的URL不应该写死,可以使用如下方法:比如说我们需要表单提交一个数据: 1.在controller控制器中我们需要先创建一个加载helper和视图的方法: ...
- P1304 哥德巴赫猜想
题目描述 输入N(N<=10000),验证4~N所有偶数是否符合哥德巴赫猜想. (N为偶数). 如果一个数,例如10,则输出第一个加数相比其他解法最小的方案.如10=3+7=5+5,则10=5+ ...
- Matplotlib库常用函数大全
Python之Matplotlib库常用函数大全(含注释) plt.savefig(‘test’, dpi = 600) :将绘制的图画保存成png格式,命名为 test plt.ylabel(‘Gr ...
- 实验6 Bezier曲线生成
1.实验目的: 了解曲线的生成原理,掌握几种常见的曲线生成算法,利用VC+OpenGL实现Bezier曲线生成算法. 2.实验内容: (1) 结合示范代码了解曲线生成原理与算法实现,尤其是Bezier ...
- UVa340未完成
#include<stdio.h> #define maxn 1010 int main() { ; while(scanf("%d",&num)!=EOF&a ...