HDU 1727 Hastiness(模拟)

Hastiness

Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 1793 Accepted Submission(s): 693

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.

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.

Sample Input
2034
1234
123
24
0Sample Output
two thousand and thirty-four
one thousand and two hundred and thirty-four
one hundred and twenty-three
twenty-four
zeroAuthor
威士忌Source
HZIEE 2007 Programming Contest

模拟模拟,

*#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
using namespace std;
int main()
{char a[100][100];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(a[30],"thirty");strcpy(a[40],"forty");strcpy(a[50],"fifty");strcpy(a[60],"sixty");strcpy(a[70],"seventy");strcpy(a[80],"eighty");strcpy(a[90],"ninety");int k,x,y,z,t;while(scanf("%d",&k)!=EOF){if(k/1000!=0){x=k/1000;printf("%s thousand",a[x]);y=k/100%10;if(y!=0)printf(" and %s hundred",a[y]);z=k/10%10;t=k%10;if(z==0){if(t==0){printf("\n");continue;}printf(" and %s\n",a[t]);continue;}else if(z==1){z=k%100;printf(" and %s\n",a[z]);continue;}else{if(t==0){printf(" and %s\n",a[k%100]);continue;}printf(" and %s-%s\n",a[z*10],a[t]);continue;}}else if(k/100!=0){y=k/100%10;if(y!=0)printf("%s hundred",a[y]);z=k/10%10;t=k%10;if(z==0){if(t==0){printf("\n");continue;}printf(" and %s\n",a[t]);continue;}else if(z==1){z=k%100;printf(" and %s\n",a[z]);continue;}else{if(t==0){printf(" and %s\n",a[k%100]);continue;}printf(" and %s-%s\n",a[z*10],a[t]);continue;}}else if(k/10!=0){z=k/10%10;t=k%10;if(z==0){if(t==0){printf("\n");continue;}printf("%s\n",a[t]);continue;}else if(z==1){z=k%100;printf("%s\n",a[z]);continue;}else{if(t==0){printf("%s\n",a[k%100]);continue;}printf("%s-%s\n",a[z*10],a[t]);continue;}}elseprintf("%s\n",a[k]);}return 0;
}

转载于:https://www.cnblogs.com/nanfenggu/p/7899984.html

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/268082.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

手机支付:电信运营商会被边缘化吗?!

手机支付未来有巨大的发展机会&#xff0c;这点大家没有意见。手机支付运营商会在其中扮演重要角色&#xff0c;这可能也是大家都没有意见的说法。但是&#xff0c;我相信&#xff0c;这个说法可能会越来越有问题。有一天手机支付&#xff0c;电信运营商被边缘化也不是没有可能…

第七周作业

#include<stdio.h> int main(){int i,N;scanf("%d",&N);double s0;int flag-1;for(i1;i<N;i){ flag-flag; ssi*1.0/(2*i-1)*flag; } printf("%0.3f",s); return 0; } 7-3&#xff1a; 设计思路&#xff1a; &#xff08;1&#xff09;定义变量…

使用Exchange 2007的几个注意事项

http://wangchunhai.blog.51cto.com/225186/152384Exchange Server 2007是Microsoft推出的电子邮件服务器软件&#xff0c;该产品与Exchange Server 2003的改进很大&#xff0c;第一次使用该产品的用户&#xff0c;会碰到一些问题。本文将为大家介绍Exchange 2007中“比较困惑”…

exception is org.springframework.beans.factory.NoUniqueBeanDefinitionException

原因&#xff1a; Spring Boot异常org.springframework.beans.factory.NoUniqueBeanDefinitionException&#xff1a;没有可用的合格Bean类型&#xff1a;预期匹配单个Bean&#xff0c;但是匹配到了多个&#xff0c;当该bean被自动装配时与Spring Boot应用程序上下文中的两个或…

大数据平台助力核与辐射安全监管

大数据平台助力核与辐射安全监管 核能开发利用是大国发展的战略必争之地&#xff0c;也是调整能源结构、应对气候变化和建设生态文明&#xff0c;进而确保国家安全的重要手段。虽然我国核与辐射安全监管能力不断提升&#xff0c;但仍面临诸多挑战。 为适应新形势和新要求&#…

cube、rollup及exec的用法实例

cube、rollup及exec的用法实例 select sdept 系部,sno 学号,max(sage) 最大年龄, grouping(sno) s1/**goruping是一个聚合函数,其产生一个附加的列,当用cube或rollup运算符添加行时,附加的列输出值为1, 当所添加的行不是由cube或rollup产生时,附加列值为…

某近似模板题2

P3388 【模板】割点&#xff08;割顶&#xff09; 题目背景 割点 题目描述 给出一个n个点&#xff0c;m条边的无向图&#xff0c;求图的割点。 输入输出格式 输入格式&#xff1a; 第一行输入n,m 下面m行每行输入x,y表示x到y有一条边 输出格式&#xff1a; 第一行输出割点个数 …

Linux命令之hexdump

用途说明 hexdump命令一般用来查看”二进制“文件的十六进制编码&#xff0c;但实际上它的用途不止如此&#xff0c;手册页上的说法是“ascii, decimal, hexadecimal, octal dump“&#xff0c;这也就是本文标题为什么要将”十六“给引起来的原因&#xff0c;而且它能查看任何文…

流星,刹那间划过天际

此文献给那些已经经历,正在经历或者还没有经历恋爱的人们。流星&#xff0c;刹那间划过天际——佛说&#xff1a;前生一百次回眸&#xff0c;换来今生的一次邂逅一年前的一次恋爱让我疲惫不堪&#xff0c;在同学们羡慕眼光中的我们在刚刚上大学的时候就平静的分手了,一切都是那…

Tomcat 配置文件

Tomcat 站点配置1、bin目录下 1、catalina tomcat 主脚本、执行Java命令调用tomcat的启动与停止 2、cpappend 用于windows系统内部&#xff0c;将项目路径追加至tomcat的classpath 环境变量中 3、digest 生成tomcat密码的加密摘要 4、service 该脚本以windows方式安装卸载to…

SpringBoot启动项目出现Error:(3, 30) java: 程序包com.alibaba.druid.pool 程序包不存在——解决办法

运行程序报错 解决方法&#xff1a; mac电脑 Preference----->Build&#xff0c;Execution&#xff0c;Deployment——>maven—>Runner——>勾选Delegate IDE windows电脑 File—>Settings----->Build&#xff0c;Execution&#xff0c;Deployment——>…

bzoj4566

后缀自动机dp 一个串在另一个串上跑。 先对A建出自动机&#xff0c;然后用B在上面跑&#xff0c;记录当前匹配的最大长度&#xff0c;每次经过一个节点记录经过次数&#xff0c;并加上(len-Max(par))*Right&#xff0c;是这个状态对答案的贡献&#xff0c;然后把每个节点的出现…

选好财务软件做好企业管理

现代企业管理中&#xff0c;如何将企业内部控制做到最佳是各个企业所极力追求的。而财务管理作为现代企业管理的核心&#xff0c;无疑是进行企业内部控制的不二法宝&#xff0c;随着社会经济不断发展&#xff0c;其核心地位更显重要。  某进出口有限公司是镇江市龙头出口外贸…

WindowsPhone7入手,实在的照片

WindowsPhone7入手&#xff0c;实在的照片 随着Silverlight在WP7上的重要体现增加&#xff0c;开发技术要先行一步&#xff0c;不管怎么样&#xff0c;先开始做这方面的准备&#xff0c;几经周折之后&#xff0c;终于搞来WindowsPhone7一部&#xff0c;手感和体验相当不错&…

UVA 11149.Power of Matrix-矩阵快速幂倍增

Power of Matrix UVA - 11149 代码: 1 #include <cstdio>2 #include <cstring>3 #include <iostream>4 #include <algorithm>5 using namespace std;6 #define maxn 447 #define mod 108 int n;9 struct matrix{ 10 int f[maxn][maxn]; 11 }; 12 …

JDK动态代理和CGLIB动态代理的区别

JDK动态代理和CGLIB动态代理的区别