TZC 1472 inverse positive integer, go to leading 0 (Java one word seconds kill)

Source: Internet
Author: User

Inverse positive integer

http://acm.tzc.edu.cn/acmhome/problemdetail.do?&method=showdetail&id=1472

Time limit (ordinary/java): 1000ms/10000ms

Run Memory limit: 65536KByte

Describe

Enter a three-bit positive integer to reverse the output.

Input

3-bit positive integer

Output

Positive integer after output inversion (removal of leading 0)

Sample input

123

Sample output

321

Tips

Attention:
130 after the reset is 31.

Complete code:

/*328ms,567kb*/
    
import java.util.*;  
Import java.io.*;  
    
public class Main {  
    static Scanner cin = new Scanner (new Bufferedinputstream (system.in));  
    
    public static void Main (string[] args) {  
        //while (Cin.hasnext ())  
            System.out.println (New StringBuffer (Cin.next ()). Reverse (). ToString (). Replacefirst ("^0*", ""));  

See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/Programming/sjjg/

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.