1005Spell It Right (20)
来源:互联网 发布:防止软件自动安装 编辑:程序博客网 时间:2024/06/07 22:43
1 #include <string> 2 #include <sstream> 3 #include <iostream> 4 using namespace std; 5 6 int main() 7 { 8 string str; 9 char num[10][6]={"zero","one","two","three","four","five","six","seven","eight","nine"};10 while(getline(cin,str))11 {12 int sum=0;13 for(int i=0;i<str.length();i++)14 sum+=str[i]-'0';15 string result;16 stringstream ss;17 ss<<sum;18 ss>>result;19 20 for(int i=0;i<result.length();i++)21 {22 if(i==0) printf("%s",num[ result[i]-'0' ]);23 else printf(" %s",num[ result[i]-'0' ]);24 //printf("%c",result[i]);25 }26 printf("\n");27 }28 return 0;29 }
0 0
- 1005 Spell It Right (20)
- 1005Spell It Right (20)
- 1005 Spell It Right (20)
- Spell it Right(20) 1005
- 1005 Spell it right
- [PAT] 1005 Spell It Right (20)
- 【PAT】1005 Spell It Right
- PAT 1005 Spell It Right
- 1005 Spell It Right --水
- PAT 1005 Spell It Right
- 1005. Spell It Right (20)
- PAT1005. Spell It Right (20)
- 1005. Spell It Right (20)
- 1005. Spell It Right (20)
- 1005. Spell It Right (20)
- PAT1005. Spell It Right (20)
- 1005. Spell It Right (20)
- 1005. Spell It Right (20)
- Spring Boot实践折腾记汇总
- 1004. Counting Leaves (30)
- 今年暑假不AC
- FatMouse
- 1065. A+B and C (64bit)
- 1005Spell It Right (20)
- 1006. Sign In and Sign Out
- 1009. Product of Polynomials (25)
- 1027Colors in Mars (20)
- 1035Password (20)
- 1036. Boys vs Girls (25)
- 1058A+B in Hogwarts (20)
- 1061. Dating (20)
- 功能强大的图片截取修剪神器:Android SimpleCropView及其实例代码重用简析