HDOJ1228 ( A + B ) 【字符串处理】
2012-05-13 10:56
369 查看
[align=center]Problem : 1228 ( A + B ) Judge Status : Accepted
RunId : 5937463 Language : C Author : qq1203456195
Code Render Status : Rendered By HDOJ C Code Render Version 0.01 Beta[/align]
RunId : 5937463 Language : C Author : qq1203456195
Code Render Status : Rendered By HDOJ C Code Render Version 0.01 Beta[/align]
#include <stdio.h> int find(char a,char b) { int n; switch(a) { case 'z': n=0; break; case 'o': n=1; break; case 't': n=((b=='w')?2:3); break; case 'f': n=((b=='o')?4:5); break; case 's': n=((b=='i')?6:7); break; case 'e': n=8; break; case 'n': n=9; break; } return n; } int getnum() { char str[10]; int t; scanf("%s",str); t=find(str[0],str[1]); scanf("%s",str); if(str[0]=='+') return t; else { if(str[0]=='=') return t; else { t*=10; t+=find(str[0],str[1]); scanf("%s",str); return t; } } } int main() { int a,b; while (1) { a=getnum(); b=getnum(); if(a||b) printf("%d\n",a+b); else break; } return 0; } #include <stdio.h> int find(char a,char b) { int n; switch(a) { case 'z': n=0; break; case 'o': n=1; break; case 't': n=((b=='w')?2:3); break; case 'f': n=((b=='o')?4:5); break; case 's': n=((b=='i')?6:7); break; case 'e': n=8; break; case 'n': n=9; break; } return n; } int getnum() { char str[10]; int t; scanf("%s",str); t=find(str[0],str[1]); scanf("%s",str); if(str[0]=='+') return t; else { if(str[0]=='=') return t; else { t*=10; t+=find(str[0],str[1]); scanf("%s",str); return t; } } } int main() { int a,b; while (1) { a=getnum(); b=getnum(); if(a||b) printf("%d\n",a+b); else break; } return 0; }
相关文章推荐
- 【字符串处理】HDOJ-1020-Encoding
- HDOJ/HDU 1039 Easier Done Than Said?(字符串处理~)
- hdoj 2072 单词数 【字符串处理】
- HDOJ/HDU 1039 Easier Done Than Said?(字符串处理~)
- 字符串处理问题系列之 To and Fro hdoj 1200
- HDOJ 1048字符串处理
- HDOJ 字符串处理简单题合集
- [HDOJ5098]Smart Software Installer(字符串处理,记忆化搜索)
- hdoj 2203 亲和串(字符串处理问题(strstr函数的巧用))
- 36th成都区域赛网络赛 hdoj4039 The Social Network(建图+字符串处理)
- hdu 1228 A+B (字符串处理) 水
- hdoj1020Encoding(字符串处理,水)
- hdoj 1217 Arbitrage(floyd+处理名字为字符串的情况)
- HDOJ/HDU 1982 Kaitou Kid - The Phantom Thief (1)(字符串处理)
- HDOJ3787(A+B)(字符串处理)
- hdoj-3000-字符串处理
- HDOJ/HDU 1982 Kaitou Kid - The Phantom Thief (1)(字符串处理)
- [ACM] hdu 1228 A+B (字符串处理)
- HDOJ 题目1073 Online Judge(字符串处理)
- hdoj 1237 简单计算器 【字符串处理】