TZC 1472 逆置正整数,去前导零 (java一句话秒杀)
逆置正整数
http://acm.tzc.edu.cn/acmhome/problemdetail.do?&method=showdetail&id=1472
时间限制(普通/Java):1000MS/10000MS 运行内存限制:65536KByte
描述
输入一个三位正整数,将它反向输出。
输入
3位正整数
输出
输出逆置后的正整数(去除前导0)
样例输入
123
样例输出
321
提示
注意:
130逆置后是31
完整代码:
/*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*", ""));}}
- 1楼u01149595227分钟前
- 神牛啊。。。