hdoj 1727 Hastiness
来源:互联网 发布:手机qq java 编辑:程序博客网 时间:2024/05/19 00:41
Hastiness(链接)
模拟
#include<cstdio>#include<cstring>using namespace std;char one[20][10]={"zero","one","two","three","four","five","six","seven","eight","nine","ten"};char two[20][10]={"eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"};char gg[20][10]={"twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"};int main(){ int num; while(scanf("%d",&num)!=EOF) { int a,b,c,d; a=num/1000; b=num%1000/100; c=num%100/10; d=num%10; if(a>0) { printf("%s thousand",one[a]); if(b>0) { printf(" and "); printf("%s hundred",one[b]); if(c>0) { printf(" and "); if(c<2) { if(d==0) printf("%s",one[10]); else printf("%s",two[d-1]); } else { if(d>0) printf("%s-%s",gg[c-2],one[d]); else printf("%s",gg[c-2]); } } else { if(d>0) printf(" and %s",one[d]); } } else { if(c>0) { printf(" and "); if(c<2) { if(d==0) printf("%s",one[10]); else printf("%s",two[d-1]); } else { if(d>0) printf("%s-%s",gg[c-2],one[d]); else printf("%s",gg[c-2]); } } else { if(d>0) printf(" and %s",one[d]); } } } else { if(b>0) { printf("%s hundred",one[b]); if(c>0) { printf(" and "); if(c<2) { if(d==0) printf("%s",one[10]); else printf("%s",two[d-1]); } else { if(d>0) printf("%s-%s",gg[c-2],one[d]); else printf("%s",gg[c-2]); } } else { if(d>0) printf(" and %s",one[d]); } } else { if(c>0) { if(c<2) { if(d==0) printf("%s",one[10]); else printf("%s",two[d-1]); } else { if(d>0) printf("%s-%s",gg[c-2],one[d]); else printf("%s",gg[c-2]); } } else { printf("%s",one[d]); } } } printf("\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
- 巧用栈结构实现迷宫游戏
- 数据结构-二叉树-建立,输出,计算长度-C++
- 160个练手CrackMe-030
- 11.11考试总结
- 数据结构部分考点整理
- hdoj 1727 Hastiness
- 多线程问题
- OpenMAX编程-数据结构
- [LeetCode]Container With Most Water
- Android短信验证码
- java使用axios.js的post请求后台时无法接收到参数的问题
- spring-cloud中config配置中心使用(基本使用)
- ionic购物车
- ValueError: too many values to unpack