Common Java Code for ACM

Source: Internet
Author: User

1 ImportJava.util.*;2 ImportJava.io.*;3 4  Public classMain {5      Public Static voidMain (string[] args)throwsioexception{6         //Calculate program Run time7         //Arrays8         LongSt =System.currenttimemillis ();9         if("abc" = = "abc") System.out.println ("Yes1");TenString str1 =NewString ("ABC"); OneString str2 =NewString ("ABC"); A         if(str1 = = str2) System.out.println ("Yes2"); -         if(Str1.equals (STR2)) System.out.println ("Yes3"); -          the         // -         int[] t = {5, 1, 3, 2, 9}; - Arrays.sort (t); - System.out.println (arrays.tostring (t)); +         int[] s =New int[10]; -Arrays.fill (S, 33); + System.out.println (arrays.tostring (s)); A         //Returns ((-insertion point)-1) If key is not exists. atSystem.out.println (Arrays.binarysearch (T, 4)); -         intCNT = 0; -          for(inti = 1; i < 100000000; i++) {cnt++;} -         Longed =System.currenttimemillis (); -System.out.println ("Time:" + (Ed-St)); -          in         //String Hash -String str =NewString ("Hello World"); toSystem.out.println ("Hash Code:" +Str.hashcode ()); +          -         //Bufferreader Buffering and line-wrapping read function theBufferedReader cin =NewBufferedReader (NewInputStreamReader (system.in)); *         intsum = 0; $String SS =NULL;Panax Notoginseng          while((ss = Cin.readline ())! =NULL) { -Sum + =Integer.parseint (ss); the         } +System.out.println ("The sum is:" +sum); A          the         // +          -     } $}

Common Java Code for ACM

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.