Hdu 2054 A = B?

Source: Internet
Author: User

Hdu 2054 A = B?
A = B?Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission (s): 64227 Accepted Submission (s): 10057


Problem DescriptionGive you two numbers A and B, if A is equal to B, you shoshould print "YES", or print "NO ".
Inputeach test case contains two numbers A and B.

Outputfor each case, if A is equal to B, you shoshould print "YES", or print "NO ".
Sample Input

1 22 23 34 3

Sample Output
NOYESYESNO: Check whether a is equal to B. Thinking: There are many situations where there are symbols, unsigned ones, or 0.1 and. 1 is equal, but also pay attention to the useless 0. I will remove all the useless 0 behind the front and back, and then judge the problem of the symbol by minute. the decimal point problem, the code is long, there is a very short code, and it has passed, but 01 and 1, + 1 and 1 are not correct in many cases, but it is correct !,,, I don't quite understand. Attach the super short code. This question is really annoying!
# Include
  
   
# Include
   
    
Char a [150000], B [150000], c [150000], d [150000]; int main () {int I, j, k, l, lena, lenb; while (scanf ("% s", a, B )! = EOF) {lena = strlen (a); lenb = strlen (B); for (I = 0; I
    
     
= 0; j --) {if (a [j]! = '0') {a [j + 1] = '\ 0'; break ;}} if (a [j] = '. ') a [j] =' \ 0'; break ;}// remove the useless 0 behind the decimal point for (I = 0; I
     
      
= 0; j --) {if (B [j]! = '0') {B [j + 1] = '\ 0'; break ;}} if (B [j] = '. ') B [j] =' \ 0'; break;} // remove the useless 0 behind the decimal point if (strcmp (a, B) = 0) printf ("YES \ n"); else if (a [0] = '+' & B [0] = '-') | (a [0] = '-' & B [0] = '+') // printf ("NO \ n") with different symbols "); else if (a [0] = '+' & B [0] = '+ ') | (a [0] = '-' & B [0] = '-') {// for (I = 1; I
      
       
# Include
       
         Char a [150000], B [150000]; void f (char * s) {int lens; lens = strlen (s); if (strchr (s ,'.')! = NULL) {while (s [-- lens] = '0'); if (s [lens] = '. ') lens --; s [lens + 1] =' \ 0';} int main () {while (scanf ("% s", a, B) = 2) {f (a); f (B); if (strcmp (a, B) = 0) printf ("YES \ n "); else printf ("NO \ n");} return 0 ;}
       
      
     
    
   
  





Related Article

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.