码迷,mamicode.com
首页 > 移动开发 > 详细

模拟 HDOJ 5099 Comparison of Android versions

时间:2015-05-19 18:20:18      阅读:129      评论:0      收藏:0      [点我收藏+]

标签:

 

题目传送门

 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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!