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

为什么要开数组呢

Posted by TSERROF at 2012-08-05 15:54:41 on Problem 1519
直接加起来就好了,呵呵O(∩_∩)O~
#include<cstdio>
int main()
{
	int ans=0;
	char ch=0;
	while(scanf("%c",&ch)!=EOF)
	{
		if(ch=='\n')
		{
			if(ans==0)break;
			ans%=9;
			if(ans!=0)printf("%d\n",ans);
			else printf("9\n");
			ans=0;
		}
		else ans+=(ch-'0');
	}
	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