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): 1172 Accepted Submission(s): 470
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.
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<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的更多相关文章
- 模拟 HDOJ 5099 Comparison of Android versions
题目传送门 /* 题意:比较型号的大小 模拟:坑点在长度可能为5,此时设为'A' */ #include <cstdio> #include <algorithm> #incl ...
- HDOJ 5099 Comparison of Android versions 坑题
现场赛的时候错了十四次. . ... Comparison of Android versions Time Limit: 2000/1000 MS (Java/Others) Memory L ...
- 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 ...
- The YubiKey -- COMPARISON OF VERSIONS
COMPARISON OF YUBIKEY VERSIONS BASICSTANDARD & NANO BASICEDGE & EDGE-N PREMIUMNEO & NE ...
- Android官方文档翻译 十五 3.3Supporting Different Platform Versions
Supporting Different Platform Versions 支持不同的平台版本 This lesson teaches you to 这节课教给你 Specify Minimum a ...
- Android Platform Guide
This guide shows how to set up your SDK environment to deploy Cordova apps for Android devices, and ...
- Android 扫描条形码(Zxing插件)
使用Android Studio 一.在build.gradle(Module:app)添加代码 下载,调用插件 1 apply plugin: 'com.android.application' ...
- Android Weekly Notes Issue #225
Android Weekly Issue #225 October 2nd, 2016 Android Weekly Issue #225 本期内容包括: Android 7.0的Quick Sett ...
随机推荐
- webpack基础知识点
webpack 是一个现代的 JavaScript 应用程序的模块打包器(module bundler). 入口(Entry) webpack 将创建所有应用程序的依赖关系图表(dependency ...
- 2015 Multi-University Training Contest 6 hdu 5360 Hiking
Hiking Time Limit: 6000/3000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Total Su ...
- l洛谷 P2326 AKN’s PPAP
P2326 AKN’s PPAP 题目描述 “I have a pen,I have an apple.Eh,Apple-Pen!. I have a pen,I have pineapple.En, ...
- Solaris 10 改ip參考文档之二
參考自:Cannot change IP address of Solaris[TM] 10 host (Doc ID 1007942.1) 本文不做翻译.全文转载. Symptoms Changin ...
- XML 解析---dom解析和sax解析
眼下XML解析的方法主要用两种: 1.dom解析:(Document Object Model.即文档对象模型)是W3C组织推荐的解析XML的一种方式. 使用dom解析XML文档,该解析器会先把XML ...
- linux openssl加密文件
openssl 支持的加密算法 -aes-128-cbc -aes-128-cfb -aes-128-cfb1 -aes-128-cfb8 -aes-128-ecb -aes-128-ofb -aes ...
- uva725_一道水题(优化到了29ms)
//////////////////////////////////////////////////////////////////////////////////////////////////// ...
- Okio简化处理I/O操作原理
转载:http://blog.csdn.net/sbsujjbcy/article/details/50523623 Okio库是一个由square公司开发的,它补充了java.io和java.nio ...
- QStandardItemModel的data线程安全(在插入数据时,临时禁止sizeHint去读model中的data)
版权声明:本文为博主原创文章,欢迎转载,转载请注明出处 https://blog.csdn.net/MatchYang/article/details/52988257 在直接使用QStandardI ...
- php和js区别
php和js区别 两者在语法上类似,楼上说的对,js=javascript是工作在浏览器端的脚本语言,他所提交的数据是交给浏览器来处理的.但是现在的Ajax技术已经可以把js提交的数据交付到浏览器来处 ...