Question link: http://acm.hdu.edu.cn/showproblem.php? PID = 1, 2054
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
Ideas:
The key to this question is to find the decimal point. Find the decimal point and remove the zero that is not valid at the end, and then compare it;
The Code is as follows:
# Include <cstdio> # include <cstring> char a [100017], B [100017]; void Re (char s []) {int Len = strlen (s ); int p = 0; For (INT I = 0; I <Len; I ++) {If (s [I] = '. ') {p = 1; break;} If (p) {for (INT I = len-1; I> = 0; I --) {If (s [I] = '0') s [I] = '\ 0'; else break; Len --;} If (s [len-1] = '. ') s [len-1] =' \ 0';} int main () {While (~ Scanf ("% S % s", a, B) {re (a); // printf ("% s \ n", a); Re (B ); // printf ("% s \ n", B); If (strcmp (a, B) printf ("NO \ n "); else printf ("Yes \ n");} return 0 ;}
HDU 2054 A = B? (Decimal point)