코드비교

Old VersionNew Version
1import java.util.*; 1import java.util.Scanner;
   2import java.io.*;
2public class Main { 3public class Main { 
3public static void main(String[] args) { 4public static void main(String[] args) { 
4Scanner scan = new Scanner (System.in); 4Scanner input = new Scanner(System.in);
5int n = scan.nextInt(); 5String tempp = "";
6String blank = scan.nextLine(); 6int test = input.nextInt();
7for (int i = 0; i < n; i ++) { 7while (test < 0 || test > 1000 ) {
8int input = scan.nextInt(); 8test = input.nextInt();
9int num = input;   
10String numFlip = "";   
11while ( num != 0) {   
12numFlip = numFlip + num % 10;   
13num = num / 10;   
14} 10} 
15System.out.println(numFlip); 11for(int k = 0; k < test; k++) {
   12String reverse = "";
   13int temp = input.nextInt();
   14while (temp < 0 || temp > 1000000 ) {
   15temp = input.nextInt();
16} 16} 
  17tempp = String.valueOf(temp); 
  18int a = tempp.length(); 
  19for(int i = a - 1; i >= 0; i--) { 
  20reverse += tempp.charAt(i); 
17} 21} 
  22System.out.println(reverse); 
18} 23} 
  24}} 
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner (System.in);
int n = scan.nextInt();
String blank = scan.nextLine();
for (int i = 0; i < n; i ++) {
int input = scan.nextInt();
int num = input;
String numFlip = "";
while ( num != 0) {
numFlip =  numFlip +  num % 10;
num = num / 10;
}
System.out.println(numFlip);
}
}
}
import java.util.Scanner;
import java.io.*;
public class Main {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
String tempp = "";
int test = input.nextInt();
while (test < 0 || test > 1000 ) {
test = input.nextInt();
}
for(int k = 0; k < test; k++) {
String reverse = "";
int temp = input.nextInt();
while (temp < 0 || temp > 1000000 ) {
temp = input.nextInt();
}
tempp = String.valueOf(temp);
int a = tempp.length();
for(int i = a - 1; i >= 0; i--) {
reverse += tempp.charAt(i);
}
System.out.println(reverse);
}
}}