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

field=problem&key=2014%C9%CF%BA%A3%C8%AB%B9%FA%D1%FB%C7%EB%C8%FC%A1%AA%A1%AA%CC%E2%C4%BF%D6%D8%CF%D6%A3%A8%B8%D0%D0%BB%C9%CF%BA%A3%B4%F3%D1%A7%CC%E1%B9%A9%CC%E2%C4%BF%A3%A9&source=1&searchmode=source" style="color:rgb(26,92,200); text-decoration:none">2014上海全国邀请赛——题目重现(感谢上海大学提供题目)

#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;

char s1[10],s2[10];
char ONE,TWO;

void BJ1()
{
    if(s1[0]<s2[0]) ONE='<';
    else if(s1[0]==s2[0]) ONE='=';
    else ONE='>';
}

void BJ2()
{
    if(s1[2]<s2[2]) TWO='<';
    else if(s1[2]==s2[2])
    {
        int day1=(s1[3]-'0')*10+s1[4]-'0';
        int day2=(s2[3]-'0')*10+s2[4]-'0';
        if(day1<day2) TWO='<';
        else if(day1==day2)
        {
            if(s1[1]==s2[1])
            {
                if(s1[5]<s2[5]) TWO='<';
                else if(s1[5]==s2[5]) TWO='=';
                else TWO='>';
            }
            else TWO='=';
        }
        else TWO='>';
    }
    else TWO='>';
}

int main()
{
    int T_T;
    int cas=1;
    scanf("%d",&T_T);
    while(T_T--)
    {
        scanf("%s%s",s1,s2);
        if(strlen(s1)<6) s1[5]='A';
        if(strlen(s2)<6) s2[5]='A';
        BJ1();BJ2();
        printf("Case %d: %c %c\n",cas++,ONE,TWO);
    }
    return 0;
}
时间: 2024-10-13 05:47:51

HDOJ 5099 Comparison of Android versions 坑题的相关文章

模拟 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

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

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 ou

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后不慌 关于“第一个输出要判断前两个字母还是只判断第一个字母就好的问题” 注意到对于第一个字母,题

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 5455 Fang Fang 坑题

Fang Fang Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=5455 Description Fang Fang says she wants to be remembered.I promise her. We define the sequence F of strings.F0 = ‘‘f",F1 = ‘‘ff",F2 = ‘‘cff",F

HDU 1498 50 years, 50 colors(最小点覆盖,坑题)

50 years, 50 colors Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 1635    Accepted Submission(s): 892 Problem Description On Octorber 21st, HDU 50-year-celebration, 50-color balloons floating

【BZOJ-1952】Area [坑题] 仙人掌DP + 最大点权独立集(改)

1952: [Sdoi2010]Area Time Limit: 10 Sec  Memory Limit: 128 MBSubmit: 73  Solved: 23[Submit][Status][Discuss] Description 小猪iPig来到了一个叫做pigsty的城市里,pigsty是一座专门为小猪所准备的城市,城市里面一共有n个小区给小猪们居住,并且存在许多条无向边连接着许多小区.因为这里是一个和谐的城市,所以小猪iPig准备在这个城市里面度过他的余生.若干年之后小猪iPig