- 浏览: 36570 次
- 性别:
- 来自: 杭州
最新评论
计算各个数字的和,并用英文将字母一个一个输出。
Sample Input:
12345
Sample Output:
one five
#include <iostream> #include <string> using namespace std; char* fun(int x) { switch(x) { case 0: return "zero"; case 1: return "one"; case 2: return "two"; case 3: return "three"; case 4: return "four"; case 5: return "five"; case 6: return "six"; case 7: return "seven"; case 8: return "eight"; case 9: return "nine"; default: return NULL; } } int main() { int sum = 0; string str; cin>>str; for(int i = 0; i < str.length(); i++) { sum = sum + (str.at(i) - '0'); } int x = sum/100; int y = (sum - x*100)/10; int z = sum%10; if( x > 0) { cout<<fun(x)<<" "<<fun(y)<<" "<<fun(z);; } else { if( y > 0) { cout<<fun(y)<<" "<<fun(z); } else { cout<<fun(z); } } return 0; }
发表评论
-
PAT1013 Battle Over Cities
2012-11-29 23:59 773Sample Input 3 2 3 1 2 1 3 ... -
PAT1003 Emergency
2012-11-29 23:46 660Sample Input 5 6 0 2 1 2 1 ... -
PAT1041 Be Unique
2012-11-23 23:43 756找出只出现过一次的数,用各种排序必然超时,需要用数组做hash ... -
PAT1042 Shuffling Machine
2012-11-23 23:42 731扑克洗牌 #include < ... -
PAT1040 Longest Symmetric String
2012-11-23 23:41 957求最长回文子串 #include < ... -
PAT1036 Boys vs Girls
2012-11-23 23:41 714Sample Input 1: 3 Joe M Mat ... -
PAT1035 Password
2012-11-23 23:40 614Sample Input 1: 3 Team0000 ... -
PAT1031 Hello World for U
2012-11-22 23:54 653Sample Input: helloworld! S ... -
PAT1029 Median
2012-11-22 23:54 651用标准库的排序全部超时,需要自己实现,另外还不能用cin co ... -
PAT1028 List Sorting
2012-11-22 23:53 805用vector最后一个用例超时了。。。 Sample ... -
PAT1027 Colors in Mars
2012-11-22 23:52 622Sample Input 15 43 71 Samp ... -
PAT1025 PAT Ranking
2012-11-22 23:51 771Sample Input: 2 5 123456789 ... -
PAT1023 Have Fun with Numbers
2012-11-21 23:55 685大数的相加 比较两个字符串中字符完全相同 Sa ... -
PAT1020 Tree Traversals
2012-11-21 23:54 650已知中序遍历 后序遍历,求层次遍历 Sample In ... -
PAT1019 General Palindromic Number
2012-11-21 23:53 536十进制转任意进制,并比较是否是回文数 Sample I ... -
PAT1037 Magic Coupon
2012-11-21 15:46 661Sample Input: 4 1 2 4 -1 ... -
PAT1038 Recover the Smallest Number
2012-11-20 23:52 1667由一道面试题改的 把数组排成最小的数 不同之处是这 ... -
PAT1024 Palindromic Number
2012-11-20 23:51 646Sample Input 1: 67 3 Sampl ... -
PAT1015 Reversible Primes
2012-11-19 23:51 768十进制转任意进制 假设十进制数为number,转 ... -
PAT1012 The Best Rank
2012-11-19 23:50 925四门功课,输出排名最高的是哪个 Sample Inpu ...
相关推荐
1005 Spell It Right (20 分)【int与string互换,hash打表】 1082 Read Number in Chinese (25 分)【将数字转成中文】 1093 Count PAT's (25 分)【PAT计数】 1071 Speech Patterns (25 分)【如何将词...
TrinityCore 版本的spell.dbc详细中文解释
wow spell editor from github。 魔兽世界技能编辑器,来自git
Lucene SpellChecker for Lucene 3.0.2
主要是SpellChecker控件的用法总结
.NET FrameWork 4.8 已经对Github上的最新版本进行调整,可以无错运行导入Spell App.Config配置数据链接及新建数据库名称 WoW-Spell-Editor-master |____Documentation BandingList对应dbc文件二进制字段列表,语言...
VS2010 Spell Checker
Vusial studio 2010 代码拼写检查SpellChecker插件.
Listen, Attend And Spell
可直接依赖 compile 'com.belerweb:pinyin4j:2.5.0' 转载网址:https://blog.csdn.net/wanxuedong/article/details/64213295
Googlie Spell Check, a simple demo
Addict SpellChecker Pro v3.3.1Addict 3 Professional: 2JLhb7Addict 3 PlusPack: lF8Ce
Spellchecking Prerequisites, Goals, and Outcomes Prerequisites: Students should have mastered the following prerequisite skills. • Hash Tables - Understanding of the concept of a recursive function ...
VisualStudio.SpellChecker.VS2013And2015.vsix——VisualStudio.SpellChecker.VS2013And2015.vsix——VisualStudio.SpellChecker.VS2013And2015.vsix
python库,解压后可用。 资源全名:spell-0.41.26-py2.py3-none-any.whl
易语言模块spell.rar 易语言模块spell.rar 易语言模块spell.rar 易语言模块spell.rar 易语言模块spell.rar 易语言模块spell.rar
Polar SpellChecker Component ActiveX控件的特点: 轻松组合 RichEdit 和 Edit 文本控件; SPT编译器:编译 Polar SpellChecker 语言平台,支持每一种可能的语言; 多个目录同时使用; 支持文本统计; ...
可用于日常文字编辑,安装后可以自动纠正输入的英文单词。
汉字转拼音的类 C# Chinese2Spell.cs
拼写纠错