This method is worth a souvenir-----------------------------larger than the size of the

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.