题面:
题意:
给定两个串a,b。
比较这两个串的无限循环的字典序大小。
题解:
Weak Periodicity Lemma
p 和 q 是字符串 s 的周期, p + q ≤ ∣ s ∣ , 则 gcd(p,q) 也是s的周期。
Periodicity Lemma
p 和 q 是字符串 s 的周期,p+q−gcd(p,q)≤∣s∣ , 则gcd(p,q) 也是 s 的周期。
没看出来和这俩定理有啥关系。。。。
但是直觉告诉我,上来莽2*max.
代码:
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<string>
#include<queue>
#include<bitset>
#include<map>
#include<unordered_map>
#include<set>
#define ui unsigned int
#define ll long long
#define llu unsigned ll
#define ld long double
#define pr make_pair
#define pb push_back
//#define lc (cnt<<1)
//#define rc (cnt<<1|1)
#define len(x) (t[(x)].r-t[(x)].l+1)
#define tmid ((l+r)>>1)
using namespace std;
const int inf=0x3f3f3f3f;
const ll lnf=0x3f3f3f3f3f3f3f3f;
const double dnf=1e18;
const int mod=1e9+7;
const double eps=1e-8;
const double pi=acos(-1.0);
const int hp=13331;
const int maxn=100100;
const int maxm=100100;
const int up=1000;
char str1[maxn],str2[maxn];
int check(void)
{
int len1=strlen(str1);
int len2=strlen(str2);
int maxx=max(len1,len2)*2;
for(int i=0;i<=maxx;i++)
{
if(str1[i%len1]<str2[i%len2]) return -1;
else if(str1[i%len1]>str2[i%len2]) return 1;
}
return 0;
}
int main(void)
{
while(scanf("%s%s",str1,str2)!=EOF)
{
int pos=check();
if(pos==0) printf("=\n");
else if(pos==-1) printf("<\n");
else printf(">\n");
}
return 0;
}