The Famous Clock

                                      Time Limit:1000MS     Memory Limit:0KB     64bit IO Format:%lld & %llu

Mr. B, Mr. G and Mr. M are now in Warsaw, Poland, for the 2012’s ACM-ICPC World Final 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. But 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 presented with Roman numerals. Mr. B cannot understand such kind of numbers. Can you translate for him?

Input

Each test case contains a single line indicating a Roman number that to be translated. All the numbers can be found on clocks. That is, each numbers in the input represents an integer between 1 and 12. Roman numbers are expressed by strings consisting of uppercase IVand X. See the sample input for further information.

Output

For each test case, display a single line containing a decimal number corresponding to the given Roman number.

Sample Input

Input:
I
II
III
IV
V
VI
VII
VIII
IX
X
XI
XII

Output:
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()
{
    int c,t,i;
    char x[10];
    char y[20][10] = {"#","I","II","III","IV","V","VI","VII","VIII","IX","X","XI","XII"};
    t=1;
    while(~scanf("%s",x))
    {
        for(i = 1;i<=12;i++)
        {
            if(strcmp(x,y[i])==0)
            {
                printf("Case %d: %d\n",t,i);
            }
        }
        t++;

    }
    return 0;
}

The Famous Clock

时间: 2025-01-08 05:13:22

The Famous Clock的相关文章

HDU 4256 The Famous Clock

The Famous Clock Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1399    Accepted Submission(s): 940 Problem Description Mr. B, Mr. G and Mr. M are now in Warsaw, Poland, for the 2012's ACM-ICPC

NYOJ 484 The Famous Clock

#include<stdio.h>#include<string.h>int main(){ int i,n=0; char a[10]; char str[15][5]={"I","II","III","IV","V","VI","VII","VIII","IX","X","

《DOM Scripting》学习笔记-——第五章、第六章 案列改进

第四章的案例代码可以得到更好的改进.例如:预留退路.向后兼容性和分离js. 原html代码: 1 <!DOCTYPE html> 2 <html lang="en"> 3 <head> 4 <meta charset="UTF-8"> 5 <title>Document</title> 6 </head> 7 <body> 8 <h1>Snapshots<

图片库改进版

body{ font-family:"Arial",serif;color:#333; background#ccc; margin:1em 10%;} h1{color:#333; background:transparent;} a{ color:#333; font-weight:bold; text-decoration:none;} ul{padding:0;} li{ float:left; padding:1em; list-style:none; border-righ

Javascript 动态添加节点(thinking in DOM)

test.html & example.js 文件说明了传统技术:document.write & innerHTML 的用法 test.html: <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title> Test </title> </head> <body> <div id="testd

JS DOM编程艺术——JS图片库2—— JS学习笔记2015-7-9(第80天)

childNodes属性: element.childNodes 它是包含这个元素的全部子元素的数组: nodeType属性: 每一个节点都有nodeType属性,这个属性可以让我们知道自己正在与哪种节点打交道 node.nodeType 返回 1 是指该节点为元素节点: 返回 2 是指该节点为属性节点: 返回 3 是指该节点为文本节点: nodeValue属性: node.nodeValue 但是这个属性在实际使用的时候需要配合childNodes才行,详情看例子 firstChild和las

JS DOM编程艺术——JS图片库—— JS学习笔记2015-7-8(第79天)

DOM是一种适用于多种环境和多种程序设计语言的通用型API. 如果想要把本书(JS DOM编程艺术)学到的DOM技巧运用在web浏览器以外的应用环境里,严格遵守“第1级DOM”能够让你避免与兼容性有关的任何问题: tips:setAttribute是第1级DOM; 图片切换初级js: <!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/

JavaScript美术馆进化史

内容选自<<JavaScript DOM 编程艺术>>第4-6章,跟着作者一起见证美术馆的进化吧. 先放效果图,然后一步步做出每个效果.每个效果都有它实用的地方,且知道过程可以更好的理解代码为什么这么写,这就是 我写这篇博文的原因. v1 v1实用的默认版本,没有实用js和css,完全是纯html.代码如下 1 <!DOCTYPE html> 2 <html lang="en"> 3 <head> 4 <meta con

js学习笔记(五)图片库实例

HTML结构如下 <!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Shopping list</title> </head> <script type="text/javascript" src=&