Hdu 2054 A = = B?

Source: Internet
Author: User

Test instructions: Determine whether two large numbers are equal.



Import Java.util.scanner;public class Main {public static void main (string[] args) {Scanner sc = new Scanner (system.in); WH Ile (Sc.hasnext ()) {String a = Sc.next (); String B = Sc.next (); a = Sweepzeroandblock (a); b = Sweepzeroandblock (b); Boolean flag = True;if (a.length () = = B.length ()) { for (int i = 0; i < a.length (); i++) {if (A.charat (i)! = B.charat (i)) {flag = False;break;}}} else {flag = false;} if (flag) {System.out.println ("yes"),} else {System.out.println ("NO");}}} Remove the useless 0 in the S string and the blank private static string Sweepzeroandblock (string s) {s = S.trim ();//Remove the unused space behind int i = S.indexof ("."); StringBuffer temp = new StringBuffer ();//Do not use this Hyper memory if (i > 0) {//is a decimal int len = i-1;//If there is no value after the decimal point then the decimal point does not have a for (int j = S. Length ()-1; J > i; j--) {Char ch = s.charat (j); if (ch >= ' 1 ' && ch <= ' 9 ') {len = J;break;}} Copy useful data from string s to temp for (int j = 0; J <= Len; j + +) {Temp.append (S.charat (j));} s = temp.tostring ();} return s;}}




A = = B?Time limit:1000/1000 MS (java/others) Memory limit:32768/32768 K (java/others)
Total submission (s): 73637 Accepted Submission (s): 11627


Problem descriptiongive You both numbers A and B, if A is equal to B, you should print, or print "NO". Give you two numbers a and B, if a=b, you should output "YES", no output "no". (A and B are large numbers, the general data type is not fit)
Inputeach test Case contains-numbers A and B.
The input contains more than one test data, and each row has two numbers.
Outputfor each case, if A was equal to B, you should print "YES", or print "NO". For each test event, you should output Yes and no output "no".
Sample Input
1 22 23) 34 3

Sample Output
Noyesyesno

Author8600 && XHD
Source Celebration Cup warm up

Hdu 2054 A = = B?

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.