Nyoj 73 than Size "string comparison"

Source: Internet
Author: User
Tags strcmp

did not see test instructions, led to WA two times, when the same time, to output a==b, I am also drunk


Time limit over size: theMs | Memory Limit:65535KB Difficulty:2
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

#include <stdio.h> #include <string.h> #define MAXN 2000char a[maxn],b[maxn];int main () {int len1,len2;while (scanf ("%s%s", b)!=eof) {Len1=strlen (a); Len2=strlen (b); if (a[0]== ' 0 ' &&b[0]== ' 0 ') break;if (a[0]== '-' &&b[0]!= '-')    printf ("a<b\n"), else if (a[0]!= '-' &&b[0]== '-') printf ("a>b\n"), else if (a[0]!= '-' &&b[0]!= '-') {if (len1>len2) printf ("a>b\n"), else if (len1<len2) printf ("a<b\n"); else if (len1==len2) {if (strcmp (A, B) >0) printf ("a>b\n"), Else if (strcmp (A, b) ==0) printf ("a==b\n"), Else if (strcmp (b) <0) printf ("a<b\n");}} else if (a[0]== '-' &&b[0]== '-') {if (len1>len2) printf ("a<b\n"); else if (len1<len2) printf ("a>b\n") ; else if (len1==len2) {if (strcmp (b) >0) printf ("a<b\n"), Else if (strcmp (A, b) ==0) printf ("a==b\n"); else if ( strcmp (A, b) <0) printf ("a>b\n");}} return 0;}







Nyoj 73 than Size "string comparison"

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.