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 描写叙述 ...
随机推荐
- Python脚本控制的WebDriver 常用操作 <十五> 处理Navigation Bar
下面将使用WebDriver来模拟操作:选择一个Navigation bar的选项 测试用例场景 Navigation Bar可以看作是简单的类似于tab的导航栏.一般来说导航栏都是ul+li.先定位 ...
- #ifdef预编译相关用法
#ifdef预编译相关用法主要有:(1)#ifdef XXX executing the corresponding xxx code #endif(2)#ifdef XXX executing th ...
- Java eclipse export jar包 包括第三方引入的jar
1.安装fatjar插件 2.export jar 说明:安装后,操作说明以官网为准,不同的版本会有不同的右键菜单,我的版本(Eclipse Java EE IDE for Web Developer ...
- boost muti-thread
背景 • 今天互联网应用服务程序普遍使用多线程来提高与多客户链接时的效率:为了达到最大的吞吐量,事务服务器在单独的线程上运行服务程序: GUI应用程序将那些费时,复杂的处理以线程的形式单独 ...
- PHP正则表达式的逆向引用与子模式 php preg_replace应用
mixed preg_replace ( mixed pattern, mixed replacement, mixed subject [, int limit]) 功能 在 subject 中搜索 ...
- ASP.NET Web - 开篇
ASP.NET运行库 服务器系统上需要ASP.NET运行库.如果系统上有IIS,就会在安装.NET Framework时为服务器配置ASP.NET运行库.开发过程中,不需要IIS,因为VS发布了自己的 ...
- Careercup - Facebook面试题 - 5733320654585856
2014-05-02 09:59 题目链接 原题: Group Anagrams input = ["star, astr, car, rac, st"] output = [[& ...
- android 开发自建wifi热点的默认ip
android 开发自建wifi热点的默认ip是:192.168.43.1 (小米3测试)
- 本地虚拟机中匿名ftp上传文件失败的问题
在10.10.50.230中新建了一个匿名的ftp服务器,结果在10.10.50.241中上传文件时提示: local: README.txt remote: /var/ftp/pub/upload ...
- execl执行解释器文件以及shell命令
问题描述: execl执行解释器文件以及shell命令 问题解决: 具体源文件: