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 huxinjie800 at 2010-08-23 23:48:30 on Problem 1509
In Reply To:状告POJ这个程序虽然是暴力但思维有漏洞我自杀,过了所有数据!!!!!! Posted by:ShenZhiBM at 2010-07-16 09:32:02
#include <iostream>
#include <cstring>
using namespace std;
char t[20005];
int main ()
{
	int n;
	int m,ans,i;
	scanf("%d",&n);
	while(n--)
	{
		scanf("%s",t);
		m=strlen(t);
		memcpy(t+m,t,m*sizeof(char));
		ans=0;
		for(i=1;i<m;i++)
		{
			if(strncmp(t+ans,t+i,m*sizeof(char))>0)ans=i;
		}
		printf("%d\n",ans+1);
	}
	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