hdu 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): 1175    Accepted Submission(s): 472

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

2014上海全国邀请赛——题目重现(感谢上海大学提供题目)

这题考的是英语,唉,英语是硬伤,,具体已经注释了

#include<stdio.h>
#include<string.h>
#define M 10
char str[M],ch[M];
char a[M],b[M];
int main(){
	int t,cas=1;
	scanf("%d",&t);
	while(t--){
		memset(a,'\0',sizeof(a));
		memset(b,'\0',sizeof(b));
		scanf("%s %s",str,ch);
		printf("Case %d: ",cas++);
		//先比较第一个字母
		if(str[0]==ch[0])
			printf("= ");
		else if(str[0]>ch[0])
			printf("> ");
		else
			printf("< ");
		//如果第二个字母一样的话,直接比较后四个
		if(str[1]==ch[1]){
			strncpy(a,str+2,4);
			strncpy(b,ch+2,4);
			if(strcmp(a,b)<0)
				printf("<");
			else if(strcmp(a,b)==0)
				printf("=");
			else
				printf(">");
		}else{//不一样就比较后三个
			strncpy(a,str+2,3);
			strncpy(b,ch+2,3);
			if(strcmp(a,b)<0)
				printf("<");
			else if(strcmp(a,b)==0)
				printf("=");
			else
				printf(">");

		}
		printf("\n");
	}
	return 0;
} 
时间: 2024-08-02 06:52:41

hdu 5099 Comparison of Android versions的相关文章

HDU 5099 Comparison of Android versions(坑水题)

C - Comparison of Android versions HDU 5099 Time Limit: 1000 MS Memory Limit: 32768 KB 64-bit integer IO format: %I64d , %I64u Java class name: Main [Submit] [Status] Description As an Android developer, itˇs really not easy to figure out a newer ver

HDU 5099 Comparison of Android versions(字符串)

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5099 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 id

hdu 5099 Comparison of Android versions 枚举题意

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5099 卡读题,实际上题目中表述的题意并不完整,所以要认真读并且加上一些现实的“常识” 关于枚举题意,感觉应该三个人分别看,然后讨论出最有可能的题意是什么 为了避免wa后心态的变化,在尽量保证不敲歪的前提下,在交之前就应该把所有可能的题意都想好,列出来,按可能性排序,再交 感觉只有做到了上面这些才能够wa后不慌 关于“第一个输出要判断前两个字母还是只判断第一个字母就好的问题” 注意到对于第一个字母,题

模拟 HDOJ 5099 Comparison of Android versions

题目传送门 1 /* 2 题意:比较型号的大小 3 模拟:坑点在长度可能为5,此时设为'A' 4 */ 5 #include <cstdio> 6 #include <algorithm> 7 #include <iostream> 8 #include <cstring> 9 #include <cmath> 10 #include <string> 11 #include <vector> 12 #include &l

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): 76    Accepted Submission(s): 60 Problem Description As an Android developer, itˇs really not e

Comparison of Android versions(strcmp的应用)

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. FRF

hdu 5099

题意:n个咖啡中,每3杯中最便宜的一杯可以免费,求最少需要付多少钱. 思路:从大到小排序,然后每逢3就免费. 1 #include<bits/stdc++.h> 2 using namespace std; 3 typedef long long ll; 4 5 struct node{ 6 int x; 7 }a[100005]; 8 9 bool cmp(node p,node q){ 10 return p.x>q.x; 11 } 12 int main(){ 13 int t;

2014上海全国邀请赛 解题报告

Game with Pearls 贪心水题 http://blog.csdn.net/u012774187/article/details/40711559 Beam Cannon 线段树陈题 http://blog.csdn.net/u012774187/article/details/40712359 Seam Carving 简单DP http://blog.csdn.net/u012774187/article/details/40712899 Battle ships 二分图陈题 ht

The YubiKey -- COMPARISON OF VERSIONS

COMPARISON OF YUBIKEY VERSIONS   BASICSTANDARD & NANO BASICEDGE & EDGE-N PREMIUMNEO & NEO-N FIDO U2F SPECIALSECURITY KEY PRICE – SINGLE QUANTITY $25 $30 $50 $18   Buy Now Show Details Buy Now Show Details Buy Now Show Details Buy Now Show Deta