Hastiness-hd1727-map
来源:互联网 发布:mac关闭程序快捷键 编辑:程序博客网 时间:2024/06/09 21:07
Hastiness
Problem Description
How many problems did you AC?
When you read this problem, don’t hasty and careless, this is also simple, haha, I didn’t cheat you.
The game over soon, WisKey starts using English begin countdown. He not only have no gene in math, but also bad in English. Fortunately, He met you who have gift in programming. So please help him to translate.
When you read this problem, don’t hasty and careless, this is also simple, haha, I didn’t cheat you.
The game over soon, WisKey starts using English begin countdown. He not only have no gene in math, but also bad in English. Fortunately, He met you who have gift in programming. So please help him to translate.
Input
Give you an integer T, output T in English, and note that all of words are lower case. (0<=T<=9999)
Output
One answer One line.
Details see sample.
Details see sample.
Sample Input
20341234123240
Sample Output
two thousand and thirty-fourone thousand and two hundred and thirty-fourone hundred and twenty-threetwenty-fourzero不细心就特别容易错 点击打开链接#include<bits/stdc++.h>///Hastiness using namespace std;map<int,string> M;map<int,string> M1;map<int,string> M2;void init(){ M[1] = "one"; M[2] = "two"; M[3] = "three"; M[4] = "four"; M[5] = "five"; M[6] = "six"; M[7] = "seven"; M[8] = "eight"; M[9] = "nine"; M[0] = "zero"; M1[1] = "ten"; M1[2] = "twenty"; M1[3] = "thirty"; M1[4] = "forty"; M1[5] = "fifty"; M1[6] = "sixty"; M1[7] = "seventy"; M1[8] = "eighty"; M1[9] = "ninety"; M2[0] = "ten"; M2[1] = "eleven"; M2[2] = "twelve"; M2[3] = "thirteen"; M2[4] = "fourteen"; M2[5] = "fifteen"; M2[6] = "sixteen"; M2[7] = "seventeen"; M2[8] = "eighteen"; M2[9] = "nineteen";}int main(){ int t,n,a,b,c,c1,c2,d; init(); while(~scanf("%d",&n)) { a=n/1000; b=n%1000/100; c1=n%100; c=c1/10; d=n%10; if(a!=0) { if(b==0&&c==0&&d==0) { cout<<M[a]<<" thousand\n"; continue; } else { cout<<M[a]<<" thousand and "; } } if(b!=0) { if(c==0&&d==0) { cout<<M[b]; printf(" hundred\n"); continue; } else { cout<<M[b]; printf(" hundred and "); } } if(c1>=20) { if(d==0) { cout<<M1[c]<<endl; continue; } else { cout<<M1[c]<<'-'<<M[d]<<endl; continue; } } if(c1<20&&c1>=10) { cout<<M2[d]<<endl; continue; } if(c1<10) { cout<<M[d]<<endl; } }}
阅读全文
0 0
- Hastiness-hd1727-map
- HDU 1727 Hastiness
- Hastiness(1727)
- hdoj-1727Hastiness
- HDU 1727-Hastiness
- HDU 1727 Hastiness(模拟)
- HDU 1727 Hastiness
- hdoj 1727 Hastiness
- HDU 1727 Hastiness
- HDU 1727:Hastiness
- HDU 1727 Hastiness(模拟)
- hdu-1727-Hastiness(字符处理)
- HDU 1727 Hastiness纯粹的英文单词拼写(就当背英文数字的单词啦)
- map
- MAP
- map
- MAP
- map
- 八:用户输入
- Nginx 搭建图片服务器
- ASP.NET Web Pages
- 算法提高 求最大值
- ARToolKit例子中simpleTest.c改写-----旋转标识卡,显示出旋转角度
- Hastiness-hd1727-map
- STK 11.3 with EOIR 11.3试用
- ASP.NET Web Pages
- redis的持久化机制
- pygame的学习以及python的巩固(窗口尺寸的显示)
- python 文件读写,删除指定行
- 九:模块初识
- java与数据库
- 感知机算法python实现