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
Sample Output
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
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: = <
题意:
1、比较两个字符串的第一个字母的大小;
2、如果两个字符串的第二个字母不同就比较接下来的三个字母的大小,
如果第二个字母相同就比较剩余的四个字母!
#include<stdio.h>
#include<string.h>
int main()
{
int t;
scanf("%d",&t);
int s=0;
while(t--)
{
++s;
char c[1000],c1[1000];
char a[10000],b[10000];
scanf("%s%s",a,b);
int l=strlen(a);
int we=strlen(b);
printf("Case %d: ",s);
if(a[0]==b[0])
printf("= ");
if(a[0]>b[0])
printf("> ");
if(a[0]<b[0])
printf("< ");
if(a[1]==b[1])
{
c[0]=a[2];
c[1]=a[3];
c[2]=a[4];
c[3]=a[5];
c[4]='\0';
c1[0]=b[2];
c1[1]=b[3];
c1[2]=b[4];
c1[3]=b[5];
c1[4]='\0';
if(strcmp(c,c1)>0)
printf(">");
else if(strcmp(c,c1)==0)
printf("=");
else
printf("<");
}
if(a[1]!=b[1])
{
c[0]=a[2];
c[1]=a[3];
c[2]=a[4];
c[3]='\0';
c1[0]=b[2];
c1[1]=b[3];
c1[2]=b[4];
c1[3]='\0';
if(strcmp(c,c1)>0)
printf(">");
else if(strcmp(c,c1)==0)
printf("=");
else
printf("<");
}
printf("\n");
}
}