hdu-1727-Hastiness(字符处理)
来源:互联网 发布:特征向量组成的矩阵 编辑:程序博客网 时间:2024/05/19 02:00
Hastiness
Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1813 Accepted Submission(s): 705
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
题意不用多解释 看样例就很清楚。。
code
#include<cstdio>#include<iostream>#include<string>using namespace std;string str1[]={"one" ,"two","three","four","five","six","seven","eight","nine","ten"};string str2[]={"eleven" ,"twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen","twenty"};string str3[]={"twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"};string str4[]={"zero","hundred","thousand"};int main(){ int n; while(~scanf("%d",&n)){ int falg=0; if(n==0) cout<<str4[0]<<endl; else { if(n>=1000){ int a=n/1000; cout<<str1[a-1]<<" "<<str4[2]; n=n%1000; falg=1; } if(n>=100){ if(falg==1) cout<<" and "; int a=n/100; cout<<str1[a-1]<<" "<<str4[1]; n=n%100; falg=1; } if(n>=20){ if(falg==1) cout<<" and "; int a=n/10; cout<<str3[a-2]; a=n%10; if(a!=0){ cout<<'-'<<str1[a-1]; } }else{ if(falg==1&&n!=0) cout<<" and "; if(n>10) cout<<str2[n%10-1]; else if(n==10) cout<<str1[9]; else if(n!=0) cout<<str1[n-1]; } cout<<endl; } } return 0;}
阅读全文
0 0
- 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(1727)
- HDU 1727 Hastiness纯粹的英文单词拼写(就当背英文数字的单词啦)
- hdoj-1727Hastiness
- hdoj 1727 Hastiness
- HDU 1228(简单的字符处理)
- 字符处理 HDU-1004
- HDU 2074 叠筐 (字符处理)
- HDU 2700 Parity【字符处理】
- 字符处理(一)
- Hastiness-hd1727-map
- 排序:快速排序与归并排序
- springboot 中拦截器的使用
- Full Binary Tree Picture——hihoCoder177
- LeetCode216. Combination Sum III
- 数据挖掘系列(10)——卷积神经网络算法的一个实现
- hdu-1727-Hastiness(字符处理)
- 【转载】解决使用tomcat7-maven-plugin插件时 “Application already exists at path”的问题
- 快速搭建视频直播平台
- 《白话深度学习与Tensorflow》学习笔记(7)RBM限制玻尔兹曼机
- 逻辑电路,零和一的实验
- Java 视频网盘分享
- PAT-1010. Radix (25)
- <深入linux内核架构>--第五章 锁与进程间通信
- LeetCode解题-#20-Valid Parentheses