标签:
1 #include <iostream> 2 #include <stdio.h> 3 #include <math.h> 4 #include <algorithm> 5 using namespace std; 6 char a[10010]; 7 int main() 8 { 9 int i,sum,t; 10 while(gets(a)){ 11 sum=0;t=0; 12 for(i=0;a[i];i++){ 13 if(a[i]==‘ ‘){ 14 t+=sum; 15 sum=0; 16 } 17 else 18 sum=sum*10+(a[i]-‘0‘); 19 } 20 t+=sum; 21 printf("%d\n",t); 22 } 23 return 0; 24 }
标签:
原文地址:http://www.cnblogs.com/wangmengmeng/p/4711548.html