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

我自己运行得好好地,提交上去却是runtime error,不知道咋回事。

Posted by ildg at 2006-04-21 13:51:38 on Problem 1863
#include <iostream>
using namespace std;

char *str="12345678910111213141516171819202122232425\
26272829303132333435363738394041424344454647484950515\
25354555657585960616263646566676869707172737475767778\
798081828384858687888990919293949596979899100101102103\
1041051061071081091101111121131141151161171181191201211\
221231241251261271281291301311321331341351361371381391\
4014114214314414514614714814915015115215315415515615715\
81591601611621631641651661671681691701711721731741751761\
771781791801811821831841851861871881891901911921931941951\
96197198199200";

const int n=492;

int main()
{
	char input[4];
	memset(input,'\0',4*sizeof(char));
	scanf("%s",input);
	int len=strlen(input);
	for(int i=0;i<=n-len;i++)
	{
		bool ok=false;
		for(int j=0;j<len;j++)
			if(str[i+j]!=input[j])
			{
				ok=false;
				break;
			}
			else
			{
				ok=true;
			}
		if(ok==true)
		{
			printf("%d",i+1);
			break;
		}
	}
	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