HDU5099——Comparison of Android versions(简单题)(2014上海邀请赛重现)
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:
/*************************************************************************
> File Name: shanghai_1010.cpp
> Author: Enumz
> Mail: 369372123@qq.com
> Created Time: 2014年11月02日 星期日 13时43分08秒
************************************************************************/ #include<iostream>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<cstring>
#include<list>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<algorithm>
#include<cmath>
#include<bitset>
#include<climits>
#define MAXN 100000
using namespace std;
char str1[],str2[];
int main()
{
int T;
cin>>T;
int times=;
while (T--)
{
cin>>str1>>str2;
printf("Case %d:",times++);
char tmp1[]={},tmp2[]={};
tmp1[]=str1[];
tmp2[]=str2[];
if (strcmp(tmp1,tmp2)>)
printf(" >");
else if (strcmp(tmp1,tmp2)<)
printf(" <");
else printf(" =");
tmp1[]=str1[];
tmp2[]=str2[];
if (strcmp(tmp2,tmp1)!=)
{
str1[]=,str2[]=;
if (strcmp(str1+,str2+)>)
printf(" >\n");
else if( strcmp(str1+,str2+)<)
printf(" <\n");
else
printf(" =\n");
}
else
{
if (strcmp(str1+,str2+)>)
printf(" >\n");
else if (strcmp(str1+,str2+)<)
printf(" <\n");
else
printf(" =\n");
}
}
return ;
}
HDU5099——Comparison of Android versions(简单题)(2014上海邀请赛重现)的更多相关文章
- HDOJ 5099 Comparison of Android versions 坑题
现场赛的时候错了十四次. . ... Comparison of Android versions Time Limit: 2000/1000 MS (Java/Others) Memory L ...
- HDU5092——Seam Carving(动态规划+回溯)(2014上海邀请赛重现)
Seam Carving DescriptionFish likes to take photo with his friends. Several days ago, he found that s ...
- HDU5093——Battle ships(最大二分匹配)(2014上海邀请赛重现)
Battle ships Problem DescriptionDear contestant, now you are an excellent navy commander, who is res ...
- HDU5090——Game with Pearls(匈牙利算法|贪心)(2014上海邀请赛重现)
Game with Pearls Problem DescriptionTom and Jerry are playing a game with tubes and pearls. The rule ...
- 模拟 HDOJ 5099 Comparison of Android versions
题目传送门 /* 题意:比较型号的大小 模拟:坑点在长度可能为5,此时设为'A' */ #include <cstdio> #include <algorithm> #incl ...
- 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 ...
- MCM试题原文及翻译 AB题 2014美国数学建模竞赛
MCM试题原文及翻译 AB题 2014美国数学建模竞赛 原创翻译,如有瑕疵,敬请谅解. 转载请注明:过客小站 » MCM试题原文及翻译 AB题 2014美国数学建模竞赛 PROBLEM A: The ...
- NYOJ 821 简单求值【简单题】
/* 解题人:lingnichong 解题时间:2014.10.18 00:46 解题体会:简单题 */ 简单求值 时间限制:1000 ms | 内存限制:65535 KB 难度:1 描写叙述 ...
随机推荐
- XSS获取cookie
在你服务器的html目录下创建joke文件夹: 在joke文件夹中创建joke.js 和joke.php joke.js 创建img标签,将它的src属性指向另一个脚本joke.php,这里关键的一点 ...
- Elastix 禁用SSL(https),还原为 http 访问
1.相关配置文件目录: Apache的配置文件:httpd.conf,位于:/etc/httpd/conf/httpd.conf,配置文件中包含 Include conf.d/*.conf ,引入了 ...
- SQLite数据库的加密【转】
1.创建空的SQLite数据库. //数据库名的后缀你可以直接指定,甚至没有后缀都可以 //方法一:创建一个空sqlite数据库,用IO的方式 FileStream fs = File.Create( ...
- 虚拟机Linux下找不到/dev/cdrom
问题描述: 笔者欲更新一下VMwareTools,结果发现虚拟机Linux上找不到设备"/dev/cdrom",当然也就不能通过命令"mount /dev/cdrom / ...
- nginx error_page 404 用 php header 无法跳转
nginx error_page 404 用 php header 无法跳转 之前用Apache的时候,只需要设置 ErrorDocument 404 /404.php 就可以在 404.php 中根 ...
- DB天气app冲刺二阶段第十天
昨天困到不行了 所以就写了那么几句..所以今天好好写写了要.. 今天的收获了一个很重要的问题 就还是api接口的事情,以前的那个接口虽然能用但是总是不稳定,今天由决定百度的一下然后就发现了一个很好用的 ...
- WWDC 2016: Rich Notifications in iOS 10
Notifications have gotten more than a visual refresh in iOS 10. As part of the new UserNotifications ...
- Django 学习笔记之三 数据库输入数据
假设建立了django_blog项目,建立blog的app ,在models.py里面增加了Blog类,同步数据库,并且建立了对应的表.具体的参照Django 学习笔记之二的相关命令. 那么这篇主要介 ...
- ubuntu中磁盘挂载与卸载
问题描述: ubuntu中磁盘的挂载和卸载 问题解决: (1)ubuntu中磁盘挂载 注: 如上所示,使用命令df查看磁盘使用情况 ...
- SQL Server 之 DBCC
--检查索引碎片情况 dbcc showconfig(tablename) 具体例子: --上图为碎片整理之前 ALTER INDEX ALL on Citation REBUILD --下图为碎片整 ...