Describe
Give you two big numbers, can you tell the size of their two numbers?
For example, 123456789123456789 to greater than-123456
-
-
Input
-
-
one row for each set of test data, enter two 1000-bit 10 binary integers, a, b
The data guarantees that the input a, B, has no prefix of 0.
If input 0 0 indicates the end of the input. No more than 10 groups of test data groups
Output
If
a>b outputs "a>b", if a<b outputs "a<b", then output "a==b" if equal.
Sample input
111111111111111111111111111 88888888888888888888-1111111111111111111111111 222222220 0
Sample output
A>ba<b
Uploaded by
Zhang Yunzun
The problem is relatively simple, mainly AC is only because not see test instructions if two numbers equal should output a==b instead of a=b
#include <iostream> #include <stdio.h> #include <string.h>using namespace Std;char a[1002],b[1002]; int main () {while (cin>>a>>b) {int X=strlen (a), Y=strlen (b), if (strcmp (A, "0") ==0&&strcmp (b, "0") = = 0) break;else{if (a[0]== '-' &&b[0]!= '-') cout<< "A<b" <<endl;else if (a[0]!= '-' &&b[0]== '-') cout<< "A>b" <<endl;else if (a[0]== '-' &&b[0]== '-') {if (x==y) {if (strcmp (b) >0) cout << "A<b" <<endl;else if (strcmp (A, b) <0) cout<< "A>b" <<endl;else if (strcmp (A, b) ==0) cout<< "A==b" <<ENDL;} else {if (x-y>0) cout<< "A<b" <<endl;else if (x-y<0) cout<< "A>b" <<ENDL;} Else{if (x==y) {if (strcmp (A, b) >0) cout<< "A>b" <<endl;else if (strcmp (A, b) <0) cout<< "A<b "<<endl;else if (strcmp (b) ==0) cout<<" A==b "<<ENDL;} else{if (x-y<0) cout<< "A<b" <<endl; else if (x-y>0) cout<< "A>b" <<endl;}}} return 0;}
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
than the size