标签:
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 */
模拟 HDOJ 5099 Comparison of Android versions
标签:
原文地址:http://www.cnblogs.com/Running-Time/p/4514900.html