题解 | #牛牛的digit#
牛牛的digit
http://www.nowcoder.com/practice/21b49f1f495f4280b8a96c415deaa3c4
import java.util.Scanner; public class Main{ public static void main(String[] args){ Scanner scanner = new Scanner(System.in); int num = scanner.nextInt(); int bits = scanner.nextInt(); StringBuilder sb = new StringBuilder(); int index = 1; while(index <= bits){ sb.insert(0, num % 10); num /= 10; index++; } System.out.print(sb.toString()); } }