nyoj 484-The Famous Clock
484-The Famous Clock
内存限制:64MB
时间限制:1000ms
特判: No
通过数:2
提交数:2
难度:1
题目描述:
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
C/C++ AC:
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <stack>
#include <set>
#include <map>
#include <queue>
#include <climits>
#include <bitset>
#define PI 3.1415926 using namespace std;
const int MY_MAX = ;
string excel_str[]={"", "I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX", "X", "XI", "XII"}; int main()
{
ios::sync_with_stdio(false);
int cnt = ;
string my_str;
while (cin >>my_str)
{
for (int i = ; i <= ; ++ i)
{
if (my_str == excel_str[i])
cout <<"Case " <<cnt ++ <<": " <<i <<endl;
}
} return ;
}
nyoj 484-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 25 A Famous Music Composer
A Famous Music Composer 时间限制:1000 ms | 内存限制:65535 KB 难度:1 描述 Mr. B is a famous music composer. O ...
- The Famous Clock
描述 Mr. B, Mr. G and Mr. M are now in Warsaw, Poland, for the 2012’s ACM-ICPC World Finals Contest. T ...
- 【南阳OJ分类之语言入门】80题题目+AC代码汇总
小技巧:本文之前由csdn自动生成了一个目录,不必下拉一个一个去找,可通过目录标题直接定位. 本文转载自本人的csdn博客,复制过来的,排版就不弄了,欢迎转载. 声明: 题目部分皆为南阳OJ题目. 代 ...
- JavaScript美术馆进化史
内容选自<<JavaScript DOM 编程艺术>>第4-6章,跟着作者一起见证美术馆的进化吧. 先放效果图,然后一步步做出每个效果.每个效果都有它实用的地方,且知道过程可以 ...
- 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 ...
随机推荐
- LeetCode初级算法--树01:二叉树的最大深度
LeetCode初级算法--树01:二叉树的最大深度 搜索微信公众号:'AI-ming3526'或者'计算机视觉这件小事' 获取更多算法.机器学习干货 csdn:https://blog.csdn.n ...
- HDU 1198 Farm Irrigation(状态压缩+DFS)
题目网址:http://acm.hdu.edu.cn/showproblem.php?pid=1198 题目: Farm Irrigation Time Limit: 2000/1000 MS (Ja ...
- 定制的print()输出格式
#定制print时的显示内容 #烤地瓜案例:主要显示格式digua("cd1","cd2","cd3""),而不是就直接在一个列表 ...
- JavaScript 变量作用域和声明提升
一.变量作用域 说到这个概念,不有自主的想到this,scope 这两个关键字. JavaScript的this总是指向一个明确的对象,这个对象是在执行的时候动态绑定的.通俗的说就是谁调用我,我的th ...
- 继承+派生+分类+钻石继承(day20)
目录 昨日内容 面对对象编程 类 定义类时发生的事情 调用类时发生的事情 init 对象 对象查找类的属性的顺序 对象的绑定方法 python中万物皆对象 今日内容 继承 什么是继承 为什么要继承 如 ...
- day10作业(函数实现注册''')
在猜年龄的基础上编写登录.注册方法,并且把猜年龄游戏分函数处理,如 登录函数 注册函数 猜年龄函数 选择奖品函数 '''在猜年龄的基础上编写登录.注册方法,并且把猜年龄游戏分函数处理,如 2. 登录函 ...
- unity 开启外部摄像头
在unity中建立一个image作为摄像头显示画面,然后通过命令render到image上即可. public WebCamTexture webTex; public string deviceNa ...
- ofd电子文档内容分析工具(分析文档、签章和证书)
前言 ofd是国家文档标准,其对标的文档格式是pdf.ofd文档是容器格式文件,ofd其实就是压缩包.将ofd文件后缀改为.zip,解压后可看到文件包含的内容. ofd文件分析工具下载:点我下载.获取 ...
- .NET如何写正确的“抽奖”——打乱数组算法
.NET如何写正确的"抽奖"--数组乱序算法 数组乱序算法常用于抽奖等生成临时数据操作.就拿年会抽奖来说,如果你的算法有任何瑕疵,造成了任何不公平,在年会现场code review ...
- postman的基本用法,请求,断言,环境变量
postman基本用法 Postman是一款功能强大的网页调试与发送网页HTTP请求的Chrome插件. 它提供功能强大的 Web API & HTTP 请求调试. 它能够发送任何类型的HTT ...