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 ...
随机推荐
- python--(常用模块-2序列化)
python--(常用模块-2序列化) 一.序列化: 把对象打散成bytes或者字符串. 方便存储和传输 序列化 把bytes或者字符串转换回对象. 反序列化 # dumps 序列化. 把对象转化成b ...
- Mysql学习总结(32)——MySQL分页技术详解
1.什么是数据分页:数据分页就是将很多条记录像书本一样分页,每页显示多少行记录: 2.为什么要数据分页:当我们进行sql语句查询时,假如数据有成千上万行记录,如果在同一个页面去显示,那这个页面得有多大 ...
- 洛谷 1156 dp
洛谷1156 dp 类背包问题 老久没有自己想出来过dp方程了,,,虽然到最后还是只写了30分,,, 设dp[j]表示最大生命值为i时的最大高度,则对于每个物品,可以选择吃掉或者放上去,即转移为dp[ ...
- struct和typedef
struct Test { int i; }; 解析:此处声明一个Test的结构体. 使用:在C语言中:struct Test t(此处的struct不可省略),在C++中:Test t(能够省略st ...
- call to OpenGL ES API with no current context 和Fatal signal 11
近日在用cocos2dx3.4的时候使用了JNI调用,发现一个现象 当不使用jni的时候全然正常.使用了jni后回去的全部文字都变成黑块,而且有概率程序崩溃.附带出了两个log call to Ope ...
- iOS KVC(Key-Value Coding)
常见用法: 获取值 valueForKey: 依据属性名取值 valueForKeyPath: 依据路径取值(如:[person valueForKeyPath:@"car.price&qu ...
- jquery outerHeight方法 outerWidth方法 获取元素实际宽度高度
曾经写代码中,每当须要获取元素的实际"宽度"(这里的宽度是指元素宽度加上其边距)时,都须要用元素宽度加上margin值才行,今天发现一个叫outerWidth(options)的方 ...
- Swift 3.0(一)
一:let 和 var let 声明的是一个常量, var 声明的是一个变量 二:简单数据类型 1.自推出数据类型 let implicitDouble = 70.0 //根据初始化时赋值的数据 ...
- SVG 贝塞尔曲线控制【方便设置】:贝塞尔曲线
http://dayu.pw/svgcontrol/
- POJ 3188暴搜
题意: 思路: 裸的暴搜 --. 但是要注意如果你不用所有的按键就能输出最优解的话一定要把所有的字母都安排到一个位置-. 我的一群PE就是这么来的-- 为什么写的人这么少-- // by Sirius ...