2020牛客多校(第一场) F- Infinite String Comparision
程序员文章站
2022-06-22 21:26:14
一开始还用了lcm疯狂超时暴力跑一边s1+s2的长度就行了#include #include #include #include #include #include
- #include
一开始还用了lcm 疯狂超时
暴力跑一边s1+s2的长度就行了
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <vector>
#include <list>
#include <set>
#include <utility>
#include <map>
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <fstream>
#include <bitset>
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;i<b.length()+a.length();i++){
if(a[flag1]>b[flag2]){
flag=1;
break;
}
if(a[flag1]<b[flag2]){
flag=2;
break;
}
flag1++;
flag2++;
if(flag1>a.length()-1)flag1=0;
if(flag2>b.length()-1)flag2=0;
}
if(flag==0)cout<<"="<<endl;
else if(flag==1)cout<<">"<<endl;
else if(flag==2)cout<<"<"<<endl;
}
return 0;
}
本文地址:https://blog.csdn.net/qq_43381490/article/details/107457942
推荐阅读
-
2020牛客暑期多校 第一场 F Infinite String Comparision(字符串)
-
I 1 or 2 2020牛客暑期多校第一场
-
2020牛客暑期多校训练营(第一场)B Infinite Tree 虚树
-
2020牛客多校(第一场) F- Infinite String Comparision
-
2020牛客暑期多校第一场J题
-
I 1 or 2 2020牛客暑期多校第一场
-
2020牛客多校(第一场) F- Infinite String Comparision
-
2020牛客暑期多校 第一场 F Infinite String Comparision(字符串)
-
2020牛客暑期多校训练营(第一场)B Infinite Tree 虚树