2020牛客多校(第一场) F- Infinite String Comparision

2020牛客多校(第一场) F- Infinite String Comparision_第1张图片

 2020牛客多校(第一场) F- Infinite String Comparision_第2张图片

 2020牛客多校(第一场) F- Infinite String Comparision_第3张图片

 一开始还用了lcm 疯狂超时 

 暴力跑一边s1+s2的长度就行了

#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
using namespace std;
#define ll long long
#define lll __int128
#define uchar unsigned char
#define ushort unsigned short
#define uint unsigned int
#define ulong unsigned long
#define ull unsigned long long
#define INT_INF 0x7fffffff
#define pi acos(-1)
#define mx(a,b) (a) > (b) ? (a) : (b)
#define mn(a,b) (a) < (b) ? (a) : (b)
#define mem(a,b) memset(a,b,sizeof(a))
#define fre(a) freopen(a,"r",stdin)
#define cio ios::sync_with_stdio(false); // Do not use it with "scanf" and other c input!
#define pb push_back
#define rep(i,a,b) for (int i = a;i <= b;i ++)
#define pre(i,a,b) for (int i = a;i >= b;i --)
#define REP(i,a,b) for (int i = a;i < b;i ++)
#define read(a,s,n) rep(i,s,n) scanf("%d",a + i);
#define READ(a,s,n) REP(i,s,n) scanf("%d",a + i);
#define read_ll(a,s,n) rep(i,s,n) scanf("%lld",a + i);
#define READ_ll(a,s,n) REP(i,s,n) scanf("%lld",a + i);
#define _T_(T) int T;scanf("%d",&T);while (T --)
#define _E_(T) while (~T)
#define endl '\n'
#define itn int
#define nit int
#define inr int
#define mian main
#define ednl endl
#define fro for
#define fir for
#define reutrn return
#define retunr return
#define reutnr return
#define eps 1e-10
const int maxn = 1e6 + 10;
long long gcd(long long a, long long b)
{
    return b == 0 ? a : gcd(b, a%b);
}
long long lcm(long long  a, long long b)
{
    return a * (b/gcd(a, b)); 
}
int main(){ 
    
    string a,b;
    while(cin>>a>>b){
    int flag1=0,flag2=0,flag=0;//1> 2< 0=
    for(long long i=0;ib[flag2]){
           flag=1;
           break;
       }
       if(a[flag1]a.length()-1)flag1=0;
       if(flag2>b.length()-1)flag2=0;
    }
    if(flag==0)cout<<"="<"<

 

你可能感兴趣的:(2020牛客多校(第一场) F- Infinite String Comparision)