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
RunId : 5937463 Language : C Author : qq1203456195
Code Render Status : Rendered By HDOJ C Code Render Version 0.01 Beta
#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; }