首页 > 其他 > 详细

The Famous Clock

时间:2014-03-07 06:34:28      阅读:447      评论:0      收藏:0      [点我收藏+]
bubuko.com,布布扣
 1 /*
 2 描述
 3 Mr. B, Mr. G and Mr. M are now in Warsaw, Poland, for the 2012’s ACM-ICPC World Finals Contest.
 4  They’ve decided to take a 5 hours training every day before the contest. Also, 
 5  they plan to start training at 10:00 each day since the World Final Contest will do so.
 6   The scenery in Warsaw is so attractive that Mr. B would always like to take a walk outside for a while after breakfast.
 7    However, Mr. B have to go back before training starts, otherwise his teammates will be annoyed. Here is a problem: 
 8         Mr. B does not have a watch. In order to know the exact time, he has bought a new watch in Warsaw, 
 9         but all the numbers on that watch are represented in Roman Numerals. Mr. B cannot understand such kind of numbers. 
10         Can you translate for him?
11 输入
12 Each test case contains a single line indicating a Roman Numerals that to be translated. All the numbers can be found on clocks. 
13 That is, each number in the input represents an integer between 1 and 12. Roman Numerals are expressed by strings consisting of uppercase ‘I’,
14  ‘V’ and ‘X’. See the sample input for further information.
15 输出
16 For each test case, display a single line containing a decimal number corresponding to the given Roman Numerals.
17 样例输入
18 I
19 II
20 III
21 IV
22 V
23 VI
24 VII
25 VIII
26 IX
27 X
28 XI
29 XII
30 样例输出
31 Case 1: 1
32 Case 2: 2
33 Case 3: 3
34 Case 4: 4
35 Case 5: 5
36 Case 6: 6
37 Case 7: 7
38 Case 8: 8
39 Case 9: 9
40 Case 10: 10
41 Case 11: 11
42 Case 12: 12
43 */
44 #include<stdio.h>
45 #include<string.h>
46 int main()
47 {
48     char s[12][10]={"I","II","III","IV","V","VI","VII","VIII","IX","X","XI","XII"},c[10];
49     int i, j=1;
50     while(scanf("%s",c) != EOF)
51     {
52         for(i = 0; i<12; i++)
53             if(strcmp(c,s[i])==0)//将c与没行测试数据进行比较 
54             printf("Case %d: %d\n",j++,++i);
55     }
56     return 0;
57 }
bubuko.com,布布扣

The Famous Clock,布布扣,bubuko.com

The Famous Clock

原文:http://www.cnblogs.com/a604378578/p/3585212.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!