while(scanf("%lld",&a)!=EOF )//输入终止标志 { while(scanf("%lld",&a)==1){ sum += a; if (getchar() == '\n')//遇到换行符退出次层循环 break; }