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

为什么说我超出output

Posted by 9990123 at 2006-07-27 19:43:41 on Problem 1047
#include <string>
#include <algorithm>
#include <iostream>
using namespace std;
int main()
{
	char data[70];
	while (scanf("%s",data))
	{
		int no = strlen(data);
		int flag =0;
		int i,temp,num=0;
		for (i = 0;i<no;i++)
		{
			if (data[i] =='0')
				num++;
		}
		if (num == no) 
		{
			printf("%s is cyclic\n",data);
			memset(data,0,sizeof(data));
			continue;
		}
		num =0;
		for (i=no-1;i>=0;i--)
		{
			temp = (data[i] -'0')* (no+1) + flag;
			flag = temp /10;
			temp = temp %10;
			if (temp == 9)
			{
				num++;
			}
		}
		if (num == no) printf("%s is cyclic\n",data);
		else printf("%s is not cyclic\n",data);
		memset(data,0,sizeof(data));
	}
}
就算错也最多时wa,怎么会output错呢?





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