Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
50题留个纪念!#include<iostream> #include<string> using namespace std; int main() { string str; while(cin>>str&&str!="0") { int long1; int sum=0; long1=str.length(); for(int i=0;i<long1;i++) { sum+=int(str[i]-'0'); if(sum>=10) sum=sum-9; } cout<<sum<<endl; } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator