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/