字符串在数值上的应用 时限:1s 空间:256m
输入两个长达100位的数,输出较大的数。
输入:
10000000000000000000000000000000000000000000000000000000000000000000000000089
23
输出:
1000000000000000000000000000000000000000000000000000000000000000000000000008
Answer:
#include<bits/stdc++.h>
using namespace std;
string a,b,x,y;
int c,d;
int main()
{
cin>>a>>b;
x=a;
y=b;
c=a.size();
d=b.size();
for(int i=0;i<100-c;i++)a='0'+a;
for(int i=0;i<100-d;i++)b='0'+b;
if(a>b)cout<<x;
else cout<<y;
return 0;
}