清北学堂模拟赛day7 数字碰撞

时间:2022-06-08 21:33:08

清北学堂模拟赛day7 数字碰撞

清北学堂模拟赛day7 数字碰撞

/*
clj:水题别人都满分你不是你就完了,所以说水题一定要细心一点,有这么几个细节:①前导零的处理,全是零的时候要特判②换行要注意,不要多大一行,剩下就是水水的模拟了
*/
#include<iostream>
#include<cstdio>
#include<string>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<vector>
#define ll long long
#define fo(i,l,r) for(int i = l;i <= r;i++)
#define fd(i,l,r) for(int i = r;i >= l;i--)
using namespace std;
const int maxn = ;
ll read(){
ll x=,f=;
char ch=getchar();
while(!(ch>=''&&ch<='')){if(ch=='-')f=-;ch=getchar();};
while(ch>=''&&ch<=''){x=x*+(ch-'');ch=getchar();};
return x*f;
}
bool visa[maxn],visb[maxn],oka,okb;
char a[maxn],b[maxn];
int n;
int main(){
freopen("number.in","r",stdin);
freopen("number.out","w",stdout);
do{
a[++n] = getchar();
}while(a[n]>=''&&a[n]<='');
n--;
fo(i,,n){
b[i] = getchar();
}
fo(i,,n){
if(a[i] >= b[i]) visa[i] = true,oka = true;
if(a[i] <= b[i]) visb[i] = true,okb = true;
}
bool buga = false,bugb = false;
if(!oka) cout<<"BOOM"<<endl;
else{
fo(i,,n) if(visa[i]){
if(a[i] != '' || i == n) buga = true;
if(a[i] == '' && !buga) continue;
cout<<a[i];
}
cout<<endl;
} if(!okb) cout<<"BOOM"<<endl;
else{
fo(i,,n) if(visb[i]){
if(b[i] != '' || i == n) bugb = true;
if(b[i] == '' && !bugb) continue;
cout<<b[i];
}
}
return ;
}