Comparison of Android versions

Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)

Total Submission(s): 1172 Accepted Submission(s): 470

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
Recommend
hujie | We have carefully selected several similar problems for you:5379
5378 5377 5376 5375

#include<stdio.h>
#include<string.h>
int main(){
int tt,ncas=0;
scanf("%d",&tt);
while(tt--){
ncas++;
char s[10],t[10]; scanf("%s%s",s,t);
int len1=strlen(s),len2=strlen(t);
printf("Case %d: ",ncas); if(s[0]==t[0]){
printf("= ");
}
else{
if(s[0]>t[0]) printf("> ");
else printf("< ");
}
if(s[1]!=t[1]){
s[len1-1]='\0';
t[len2-1]='\0';
}
int temp=strcmp(s+2,t+2);
if(temp>0) printf(">");
else if(temp<0) printf("<");
else printf("=");
printf("\n");
}
return 0;
}
#include<stdio.h>
#include<string.h>
int f(char a[]){
int i,res=0;
for(i=3;;++i){
if(a[i]>='0'&&a[i]<='9') res=res*10+a[i]-'0';
else return res;
}
}
int main(){
int tt,ncas=0;
scanf("%d",&tt);
while(tt--){
ncas++;
char s[10],t[10]; scanf("%s%s",s,t);
int len1=strlen(s),len2=strlen(t);
printf("Case %d: ",ncas);
if(s[0]==t[0]){
printf("= ");
}
else{
if(s[0]>t[0]) printf("> ");
else printf("< ");
}
if(s[2]>t[2]) printf(">");
else if(s[2]<t[2]) printf("<");
else{
int x=f(s),y=f(t);
if(x==y){
if(s[1]==t[1]){
if(s[len1-1]==t[len2-1]) printf("=");
else if(s[len1-1]>t[len2-1]) printf(">");
else printf("<");
}
else printf("=");
}
else if(x>y) printf(">");
else printf("<");
}
printf("\n");
}
return 0;
}

hdoj-5099-Comparison of Android versions的更多相关文章

  1. 模拟 HDOJ 5099 Comparison of Android versions

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

  2. HDOJ 5099 Comparison of Android versions 坑题

    现场赛的时候错了十四次. . ... Comparison of Android versions Time Limit: 2000/1000 MS (Java/Others)    Memory L ...

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

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

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

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

  5. The YubiKey -- COMPARISON OF VERSIONS

    COMPARISON OF YUBIKEY VERSIONS   BASICSTANDARD & NANO BASICEDGE & EDGE-N PREMIUMNEO & NE ...

  6. Android官方文档翻译 十五 3.3Supporting Different Platform Versions

    Supporting Different Platform Versions 支持不同的平台版本 This lesson teaches you to 这节课教给你 Specify Minimum a ...

  7. Android Platform Guide

    This guide shows how to set up your SDK environment to deploy Cordova apps for Android devices, and ...

  8. Android 扫描条形码(Zxing插件)

    使用Android Studio 一.在build.gradle(Module:app)添加代码  下载,调用插件 1 apply plugin: 'com.android.application' ...

  9. Android Weekly Notes Issue #225

    Android Weekly Issue #225 October 2nd, 2016 Android Weekly Issue #225 本期内容包括: Android 7.0的Quick Sett ...

随机推荐

  1. STM32 抢占优先级和响应优先级

    一.抢占优先级和响应优先级 STM32 的中断向量具有两个属性,一个为抢占属性,另一个为响应属性,其属性编号 越小,表明它的优先级别越高. 抢占,是指打断其他中断的属性,即因为具有这个属性会出现嵌套中 ...

  2. js jquery 判断匹配元素是否存在

    jQuery 判断页面元素是否存在的代码 在传统的Javascript里,当我们对某个页面元素进行某种操作前,最好先判断这个元素是否存在.原因是对一个不存在的元素进行操作是不允许的. 例如: 复制代码 ...

  3. 【codeforces 747E】Comments

    [题目链接]:http://codeforces.com/problemset/problem/747/E [题意] 给你一个类似递归的结构; 让你把每一层的字符串按照层,一层层地输出出来; 并输出层 ...

  4. dubbo Failed to check the status of the service com.user.service.UserService. No provider available for the service

    Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'u ...

  5. FROM使用子查询

    FROM使用子查询    子查询结果充当一个临时表.    //子查询形成的临时表字段为NO,NAME,SAL   select no,name from(     select empno no,e ...

  6. 2015 Multi-University Training Contest 3 hdu 5318 The Goddess Of The Moon

    The Goddess Of The Moon Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/ ...

  7. LaTeX 表格指定宽度并居中

    本系列文章由 @YhL_Leo 出品,转载请注明出处. 文章链接: http://blog.csdn.net/yhl_leo/article/details/50532269 在绘制表格的时候,对于特 ...

  8. 洛谷 1156 dp

    洛谷1156 dp 类背包问题 老久没有自己想出来过dp方程了,,,虽然到最后还是只写了30分,,, 设dp[j]表示最大生命值为i时的最大高度,则对于每个物品,可以选择吃掉或者放上去,即转移为dp[ ...

  9. C++异常注意事项

    C++里面catch对于类型转换,限制比参数传递时候要多: 不可以进行标准算术转换和类的自定义转换:在函数参数匹配的过程中,可以进行很多的类型转换.但是在异常匹配的过程中,转换的规则要严厉. 标准算术 ...

  10. bzoj3626【LNOI2014】LCA

    3626: [LNOI2014]LCA Time Limit: 10 Sec  Memory Limit: 128 MB Submit: 1266  Solved: 448 [Submit][Stat ...