Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

50题留个纪念!

Posted by yangming13 at 2008-11-15 09:51:52 on Problem 1519
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator