hdoj-1727Hastiness
来源:互联网 发布:竞彩预测软件 编辑:程序博客网 时间:2024/05/18 21:51
Hastiness
Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1801 Accepted Submission(s): 699
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<cstdio>#include<cstring>#include<iostream>using namespace std;int main(){ char a[21][10],b[10][10]; strcpy(a[0],"zero"); strcpy(a[1],"one"); strcpy(a[2],"two"); strcpy(a[3],"three"); strcpy(a[4],"four"); strcpy(a[5],"five"); strcpy(a[6],"six"); strcpy(a[7],"seven"); strcpy(a[8],"eight"); strcpy(a[9],"nine"); strcpy(a[10],"ten"); strcpy(a[11],"eleven"); strcpy(a[12],"twelve"); strcpy(a[13],"thirteen"); strcpy(a[14],"fourteen"); strcpy(a[15],"fifteen"); strcpy(a[16],"sixteen"); strcpy(a[17],"seventeen"); strcpy(a[18],"eighteen"); strcpy(a[19],"nineteen"); strcpy(a[20],"twenty"); strcpy(b[0],"twenty"); strcpy(b[1],"thirty"); strcpy(b[2],"forty"); strcpy(b[3],"fifty"); strcpy(b[4],"sixty"); strcpy(b[5],"seventy"); strcpy(b[6],"eighty"); strcpy(b[7],"ninety"); int n,m; while(~scanf("%d",&n)) { if(!n){ printf("zero\n"); continue; } if(n>=1000) { m=n/1000; printf("%s thousand",a[m]); n-=m*1000; if(!n) { printf("\n"); continue; } printf(" and "); } if(n>=100) { m=n/100; printf("%s hundred",a[m]); n-=m*100; if(!n){ printf("\n"); continue; } printf(" and "); } if(n) { if(n<=20) printf("%s\n",a[n]); else { m=n/10; printf("%s",b[m-2]); n-=m*10; if(!n) { printf("\n"); continue; } printf ("-%s\n", a[n]); } } } return 0;}
阅读全文
0 0
- hdoj-1727Hastiness
- hdoj 1727 Hastiness
- HDU 1727 Hastiness
- Hastiness(1727)
- HDU 1727-Hastiness
- HDU 1727 Hastiness(模拟)
- HDU 1727 Hastiness
- HDU 1727 Hastiness
- HDU 1727:Hastiness
- HDU 1727 Hastiness(模拟)
- hdu-1727-Hastiness(字符处理)
- HDU 1727 Hastiness纯粹的英文单词拼写(就当背英文数字的单词啦)
- Hastiness-hd1727-map
- HDOJ
- hdoj
- hdoj
- HDOJ
- hdoj 1568 && hdoj 5344 && hdoj 5444
- 开发Web安全与防护
- 正则表达式
- 为什么要学习R?
- 1002. A+B for Polynomials (25)
- head标签与body标签的区别
- hdoj-1727Hastiness
- 素数判断的方法
- jQuery——详细总结
- python实现画一颗树和一片森林
- 模板_分离编译
- hdu 2328 & poj 3450
- ideavim使用
- bzoj 1106: [POI2007]立方体大作战tet(贪心+树状数组)
- lombok注解介绍