| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
真正暴力的程序......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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator