The idea is to use an array to rank the characters that are larger than the size from high to low to the lowest end of the character array, and then to row at a place labeled 0.
The front is not full and becomes 0. Then follow the ASCLL code row size.
time limit over size: theMs | Memory Limit:65535KB Difficulty:2describe to you two large numbers, can you determine the size of their two numbers? For example, 123456789123456789 is greater than-123456enter a row for each set of test data, enter two 1000-bit 10 binary integers, or the data to ensure that the input, A/b, does not have a prefix of 0. If input 0 0 indicates the end of the input. The number of test data groups does not exceed 10 sets of outputs if aThe >b outputs "a>b" if a<b outputs "a<b" and if equal outputs "a==B ". Sample Input111111111111111111111111111 88888888888888888888-1111111111111111111111111 222222220 0Sample Output a>BA<b
#include <stdio.h>#include<algorithm>#include<string.h>using namespacestd;intMain () {inti,j,m,n,l,l1; Chara[1001],b[1001],c[1001],d[1001]; while(SCANF ("%s%s", A, b)! =EOF) { if(a[0]=='0'&&b[0]=='0') Break; Memset (c,'0',sizeof(c)); memset (d,'0',sizeof(d)); L=strlen (a); L1=strlen (b); M=Max (L,L1); for(i=0; i<m;i++) { if(L-1-i>=0) C[m-1-i]=a[l-1-i]; if(l1-1-i>=0) D[m-1-i]=b[l1-1-i]; } for(j=i=0; i<m;i++) { if(c[i]>D[i]) { if(c[0]=='-'&&d[0]=='-') printf ("a<b\n"); Elseprintf ("a>b\n"); Break; } if(c[i]<D[i]) { if(c[0]=='-'&&d[0]=='-') printf ("a>b\n"); Elseprintf ("a<b\n"); Break; } } if(i==m) printf ("a==b\n"); J=0; } return 0;}
This method is worth a souvenir-----------------------------larger than the size of the