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 描写叙述 ...
随机推荐
- SQLServer处理亿万级别的数据的优化措施
如何在SQLServer中处理亿万级别的数据(历史数据),可以按以下方面进行: 去掉表的所有索引 用SqlBulkCopy进行插入 分表或者分区,减少每个表的数据总量 在某个表完全写完之后再建立索引 ...
- C# CacheHepler Class
internal class CacheHelper { /// <summary> /// Insert value into the cache using /// appropria ...
- Linux使用标准IO的调用函数,分3种形式实现
/*根据cp命令的格式要求,设计一个类cp的功能程序,要求使用标准IO的调用函数,分3种形式实现,字符,行,块.并注意函数功能的分层*/ #include<stdio.h> #includ ...
- 4-2.矩阵乘法的Strassen算法详解
题目描述 请编程实现矩阵乘法,并考虑当矩阵规模较大时的优化方法. 思路分析 根据wikipedia上的介绍:两个矩阵的乘法仅当第一个矩阵B的列数和另一个矩阵A的行数相等时才能定义.如A是m×n矩阵和B ...
- PIGCMS提示“你的程序为盗版,非法授权,请联系QQ7530782或者8441010”的修复方法
最近群里又有人发出来微信平台盗版源码这个问题求解决,其实我本人是一直支持正版的,大家有条件的还是购买正好为好,既然有人问我就顺便解决了下,其实很简单,再换个接口就好了,查看了一下是在\PigCms\L ...
- iOS 进阶 第六天(0402)
0402 通知和代理的区别 代理是一对一的,只能是调用实现了协议里的方法,对象作为实现了该方法才能执行方法 通知是多对多,它是通过通知中心分发 通知要及时移除,如果不及时移除可能会收到多次通知,就好像 ...
- oracle中事务处理
事务用于保证数据的一致性,它由一组相关的dml语句组成,该组的dml语句要么全部成功,要么全部失败. 事务和锁 当执行事务操作时(dml语句),oracle会在被作用的表上加锁,防止其它用户改表的结构 ...
- c语言关于二进制的输出
c语言中的二进制输出是没有占位符的,不像八进制:%o: 和十六进制:x%: c中二进制的输出 //右移31位,从最高为开始和1做&运算,得到每一位的二进制数值 void printbinry( ...
- semantic
cgfx 里会有这个 float4X4 View : View; :后面这个 view 是一种 叫做user defined semantic provide the correct data to ...
- 使用EF code first和asp.net mvc4遇到的问题总结
最近使用EF code first和asp.net mvc4做项目,遇到些问题,记录一下. 一.EF code first 生成外键列问题. 一般情况下,都是先写一个int型外键id属性,然后写一个外 ...