The Famous Clock
- 描述
-
Mr. B, Mr. G and Mr. M are now in Warsaw, Poland, for the 2012’s ACM-ICPC World Finals Contest. They’ve decided to take a 5 hours training every day before the contest. Also, they plan to start training at 10:00 each day since the World Final Contest will do so. The scenery in Warsaw is so attractive that Mr. B would always like to take a walk outside for a while after breakfast. However, Mr. B have to go back before training starts, otherwise his teammates will be annoyed. Here is a problem: Mr. B does not have a watch. In order to know the exact time, he has bought a new watch in Warsaw, but all the numbers on that watch are represented in Roman Numerals. Mr. B cannot understand such kind of numbers. Can you translate for him?
- 输入
- Each test case contains a single line indicating a Roman Numerals that to be translated. All the numbers can be found on clocks. That is, each number in the input represents an integer between 1 and 12. Roman Numerals are expressed by strings consisting of uppercase ‘I’, ‘V’ and ‘X’. See the sample input for further information.
- 输出
- For each test case, display a single line containing a decimal number corresponding to the given Roman Numerals.
- 样例输入
-
I
II
III
IV
V
VI
VII
VIII
IX
X
XI
XII - 样例输出
-
Case 1: 1
Case 2: 2
Case 3: 3
Case 4: 4
Case 5: 5
Case 6: 6
Case 7: 7
Case 8: 8
Case 9: 9
Case 10: 10
Case 11: 11
Case 12: 12#include <stdio.h>
#include <string.h> int main(){
char s[];
int number;
int time; time=; while(scanf("%s",&s)!=EOF){
if(strcmp(s,"I")==)
number=; else if(strcmp(s,"II")==)
number=; else if(strcmp(s,"III")==)
number=; else if(strcmp(s,"IV")==)
number=; else if(strcmp(s,"V")==)
number=; else if(strcmp(s,"VI")==)
number=; else if(strcmp(s,"VII")==)
number=; else if(strcmp(s,"VIII")==)
number=; else if(strcmp(s,"IX")==)
number=; else if(strcmp(s,"X")==)
number=; else if(strcmp(s,"XI")==)
number=; else if(strcmp(s,"XII")==)
number=; printf("Case %d: ",time);
time++;
printf("%d\n",number);
}
return ;
}
The Famous Clock的更多相关文章
- ACM The Famous Clock
The Famous Clock 时间限制:1000 ms | 内存限制:65535 KB 难度:1 描述 Mr. B, Mr. G and Mr. M are now in Warsaw, ...
- HDU 4256 The Famous Clock
The Famous Clock Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) ...
- nyoj 484-The Famous Clock
484-The Famous Clock 内存限制:64MB 时间限制:1000ms 特判: No 通过数:2 提交数:2 难度:1 题目描述: Mr. B, Mr. G and Mr. M are ...
- JavaScript美术馆进化史
内容选自<<JavaScript DOM 编程艺术>>第4-6章,跟着作者一起见证美术馆的进化吧. 先放效果图,然后一步步做出每个效果.每个效果都有它实用的地方,且知道过程可以 ...
- 【南阳OJ分类之语言入门】80题题目+AC代码汇总
小技巧:本文之前由csdn自动生成了一个目录,不必下拉一个一个去找,可通过目录标题直接定位. 本文转载自本人的csdn博客,复制过来的,排版就不弄了,欢迎转载. 声明: 题目部分皆为南阳OJ题目. 代 ...
- javascript DOM(2) 一个网页上切换显示不同的图片或文本
摘自: javascript DOM 编程艺术 1. 在一个网页上切换显示不同的图片 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Tran ...
- 《DOM Scripting》学习笔记-——第五章、第六章 案列改进
第四章的案例代码可以得到更好的改进.例如:预留退路.向后兼容性和分离js. 原html代码: <!DOCTYPE html> <html lang="en"> ...
- 《DOM Scripting》学习笔记-——第四章 案列分析 JS美术馆(点击链接到图片)
实现效果:点击图片链接,可以在当前网页显示图片,并且显示图片标题. Html代码 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN&qu ...
- HDU 4256 翻译罗马数字
参考自:https://www.cnblogs.com/ECJTUACM-873284962/p/6414173.html The Famous Clock Time Limit: 2000/1000 ...
随机推荐
- bzoj 2393 Cirno的完美算数教室(容斥原理+搜索)
[题意] 定义C数为只包含数字2和9的数,求[L,R]内能被C数整除的个数. [思路] Dfs预处理出C数,并去除其中倍数的情况. Dfs搜索出现情况,奇数加,偶数减,当数值大于R时剪枝. [代码] ...
- linux 切换c++版本
删除gcc-4.6的软连接文件/usr/bin/gcc.(只是删除软连接) 命令:sudo rm /usr/bin/gcc 然后建一个软连接,指向gcc-4.4. 命令:sudo ln -s /usr ...
- delphi 单例模式实现
unit Unit2; interface uses System.SysUtils; type { TSingle } TSingle = class(TObject) private FStr: ...
- 【VB技巧】VB静态调用与动态调用dll详解
本文“[VB技巧]VB静态调用与动态调用dll详解”,来自:Nuclear'Atk 网络安全研究中心,本文地址:http://lcx.cc/?i=489,转载请注明作者及出处! [[请注意]]:在以下 ...
- 第二百四十九天 how can I 坚持
竟然让我跟着他们去旅游..泡温泉,滑雪..西北坡,不去白不去. 罗娜,你别把我拉黑啊.哎,不知道咋办. 晚上玩了四局LOL,全输了,伤心. 还有今天抢票没抢到. 该怎么破,12点半正好在吃饭啊. 睡觉 ...
- CodeForces 489A SwapSort (选择排序法)
SwapSort 题目链接: http://acm.hust.edu.cn/vjudge/contest/121332#problem/A Description In this problem yo ...
- UVaLive 7360 Run Step (排列组合,枚举)
题意:给定一个数 n ,表示一共有 n 步,然后你可以迈一步也可以迈两步,但是左腿和右腿的一步和两步数要一样,并且两步数不小于一步数,问你有多少种方式. 析:虽然是排列组合,但还是不会做.....水啊 ...
- delete数组引发的core分析
delete [] ptr 引发了singnal 6 abort的core错误,跟踪过程发现写入ptr大量数据,引发内存越界,破坏了new数组的尾部数据保护,导致delete的时候core. 问题分析 ...
- 一个简洁通用的调用DLL函数的帮助类
本次介绍一种调用dll函数的通用简洁的方法,消除了原来调用方式的重复与繁琐,使得我们调用dll函数的方式更加方便简洁.用过dll的人会发现c++中调用dll中的函数有点繁琐,调用过程是这样的:在加载d ...
- const修饰的双重指针赋值解惑
在c程序中,我们可能经常会使用到指针之间的赋值. 传统的赋值操作: char *cp = "c"; const char *ccp; ccp = cp; printf(" ...