博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
The Famous Clock
阅读量:5135 次
发布时间:2019-06-13

本文共 1939 字,大约阅读时间需要 6 分钟。

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 I19 II20 III21 IV22 V23 VI24 VII25 VIII26 IX27 X28 XI29 XII30 样例输出31 Case 1: 132 Case 2: 233 Case 3: 334 Case 4: 435 Case 5: 536 Case 6: 637 Case 7: 738 Case 8: 839 Case 9: 940 Case 10: 1041 Case 11: 1142 Case 12: 1243 */44 #include
45 #include
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 }

 

转载于:https://www.cnblogs.com/a604378578/p/3585212.html

你可能感兴趣的文章
leetcode 459. 重复的子字符串(Repeated Substring Pattern)
查看>>
springboot No Identifier specified for entity的解决办法
查看>>
浅谈 unix, linux, ios, android 区别和联系
查看>>
51nod 1428 活动安排问题 (贪心+优先队列)
查看>>
latex for wordpress(一)
查看>>
如何在maven工程中加载oracle驱动
查看>>
Flask 系列之 SQLAlchemy
查看>>
aboutMe
查看>>
【Debug】IAR在线调试时报错,Warning: Stack pointer is setup to incorrect alignmentStack,芯片使用STM32F103ZET6...
查看>>
一句话说清分布式锁,进程锁,线程锁
查看>>
FastDFS使用
查看>>
服务器解析请求的基本原理
查看>>
[HDU3683 Gomoku]
查看>>
下一代操作系统与软件
查看>>
Python IO模型
查看>>
DataGridView的行的字体颜色变化
查看>>
局域网内手机访问电脑网站注意几点
查看>>
[Serializable]的应用--注册码的生成,加密和验证
查看>>
Android-多线程AsyncTask
查看>>
LeetCode【709. 转换成小写字母】
查看>>