模拟 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 <queue>
13 #include <map>
14 #include <set>
15 #include <ctime>
16 #include <cstdlib>
17 using namespace std;
18
19 const int MAXN = 1e4 + 10;
20 const int INF = 0x3f3f3f3f;
21 char s1[10], s2[10];
22
23 char check(void)
24 {
25     for (int i=2; i<=4; ++i)
26     {
27         if (s1[i] < s2[i])    return ‘<‘;
28         else if (s1[i] > s2[i])    return ‘>‘;
29     }
30
31     if (s1[1] == s2[1])
32     {
33         if (s1[5] == ‘\0‘)    s1[5] = ‘A‘;
34         if (s2[5] == ‘\0‘)    s2[5] = ‘A‘;
35         if (s1[5] < s2[5])    return ‘<‘;
36         else if (s1[5] > s2[5])    return ‘>‘;
37     }
38
39     return ‘=‘;
40 }
41
42 int main(void)        //HDOJ 5099    Comparison of Android versions
43 {
44     //freopen ("J.in", "r", stdin);
45
46     int t, cas = 0;    scanf ("%d", &t);
47     while (t--)
48     {
49         scanf ("%s%s", s1, s2);
50         char ch1 = (s1[0] == s2[0]) ? ‘=‘ : (s1[0] < s2[0]) ? ‘<‘ : ‘>‘;
51         char ch2 = check ();
52         printf ("Case %d: %c %c\n", ++cas, ch1, ch2);
53     }
54
55     return 0;
56 }
57
58 /*
59 Case 1: > >
60 Case 2: = <
61 */
时间: 2024-11-02 21:44:07

模拟 HDOJ 5099 Comparison of Android versions的相关文章

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

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

模拟 HDOJ 4552 Running Rabbits

题目传送门 1 /* 2 模拟:看懂题意,主要是碰壁后的转向,笔误2次 3 */ 4 #include <cstdio> 5 #include <algorithm> 6 #include <cstring> 7 #include <vector> 8 using namespace std; 9 10 const int MAXN = 1e3 + 10; 11 const int INF = 0x3f3f3f3f; 12 struct Rabbit 13

模拟 HDOJ 5387 Clock

题目传送门 1 /* 2 模拟:这题没啥好说的,把指针转成角度处理就行了,有两个注意点:结果化简且在0~180内:小时13点以后和1以后是一样的(24小时) 3 模拟题伤不起!计算公式在代码内(格式:hh/120, mm/120, ss/120) 4 */ 5 /************************************************ 6 * Author :Running_Time 7 * Created Time :2015-8-13 13:04:31 8 * Fil

模拟 HDOJ 5095 Linearization of the kernel functions in SVM

题目传送门 1 /* 2 题意:表达式转换 3 模拟:题目不难,也好理解题意,就是有坑!具体的看测试样例... 4 */ 5 #include <cstdio> 6 #include <algorithm> 7 #include <iostream> 8 #include <cstring> 9 #include <cmath> 10 #include <string> 11 #include <vector> 12 #i