

Hãy luôn nhớ cảm ơn và vote 5*
nếu câu trả lời hữu ích nhé!
#include <iostream>
using namespace std;
int main() {
freopen("solonhon.inp","r",stdin);
freopen("solonhon.out","w",stdout);
string a,b;
cin >> a >> b;
string A="",B="";
for (char i:a) {
A=i+A;
}
for (char i:b) {
B=i+B;
}
int nA = A.size(), nB = B.size();
while (nA<nB) {
A = '0'+A;
nA = A.size();
}
while (nA>nB) {
B='0'+B;
nB = B.size();
}
for (int i=0; i<A.size(); i++) {
if (A[i]>B[i]) {
cout << A;
return 0;
} else {
if (A[i]<B[i]) {
cout << B;
return 0;
}
}
}
}Hãy giúp mọi người biết câu trả lời này thế nào?

#include <bits/stdc++.h>
using namespace std;
long long a,b;
int main()
{
freopen("solonhon.inp","r",stdin);
freopen("solonhon.out","w",stdout);
cin>>a>>b;
if(a>b)
{
while(a!=0)
{
int s=a%10;
cout<<s;
a/=10;
}
return 0;
}
if(a<b)
{
while(b!=0)
{
int s=b%10;
cout<<s;
b/=10;
}
return 0;
}
return 0;
}
Hãy giúp mọi người biết câu trả lời này thế nào?
Bảng tin