delete pics to save space
This commit is contained in:
31
3.34895.cpp
Normal file
31
3.34895.cpp
Normal file
@ -0,0 +1,31 @@
|
||||
#include<cstdio>
|
||||
#include<cstring>
|
||||
const int maxn=1e7+5;
|
||||
char s[maxn];
|
||||
int n;
|
||||
int getmin(char *s)
|
||||
{
|
||||
int i=0,j=1,k=0,t;
|
||||
while(i<n&&j<n&&k<n)
|
||||
{
|
||||
t=s[(i+k)%n]-s[(j+k)%n];
|
||||
if(!t) k++;
|
||||
else
|
||||
{
|
||||
if(t>0) i+=k+1;
|
||||
else j+=k+1;
|
||||
if(i==j) j++;
|
||||
k=0;
|
||||
}
|
||||
}
|
||||
return (i<j?i:j)%n;
|
||||
}
|
||||
int main()
|
||||
{
|
||||
#ifdef local
|
||||
freopen("pro.in","r",stdin);
|
||||
#endif
|
||||
scanf("%s",s); n=strlen(s);
|
||||
printf("%d\n",getmin(s));
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user