코드비교

Old VersionNew Version
2public class Main { 2public class Main { 
3public static void main(String[] args) { 3public static void main(String[] args) { 
4Scanner input = new Scanner(System.in); 4Scanner input = new Scanner(System.in); 
5int T = input.nextInt(); 5int loop = input.nextInt();
6for(int i = 0; i < T; i++) { 6int[] num = new int[loop];
7int D = input.nextInt(); 7for (int i = 0; i < loop; i++) {
8while( D > 1 ) { 8num[i] = input.nextInt();
9for( int n = 2; n <= D; n++ ) { 9}
10if( D % n == 0 ) { 10for (int j = 0; j <loop; j++) {
11System.out.printf("%d", n); 11int temp = num[j];
12D = D / n; 12int trial = 1;
13if( D != 1 ) { 13for (int k = 2; temp != 1; k++) {
   14if (temp % k == 0) {
   15if (trial == 1) {
   16trial = 2;
   17}
   18else {
14System.out.print(" "); 19System.out.print(" "); 
15} 20} 
16else { 21System.out.print(k);
17System.out.print("\n"); 22temp /= k;
   23k--;
18} 24} 
19n--; 25}
   26System.out.println();
20} 27} 
21} 28} 
22} 29} 
23}   
24}   
25}   
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int T = input.nextInt();
for(int i = 0; i < T; i++) {
int D = input.nextInt();
while( D > 1 ) {
for( int n = 2; n <= D; n++ ) {
if( D % n == 0 ) {
System.out.printf("%d", n);
D = D / n;
if( D != 1 ) {
System.out.print(" ");
}
else {
System.out.print("\n");
}
n--;
}
}
}
}
}
}
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int loop = input.nextInt();
int[] num = new int[loop];
for (int i = 0; i < loop; i++) {
num[i] = input.nextInt();
}
for (int j = 0; j <loop; j++) {
int temp = num[j];
int trial = 1;
for (int k = 2; temp != 1; k++) {
if (temp % k == 0) {
if (trial == 1) {
trial = 2;
}
else {
System.out.print(" ");
}
System.out.print(k);
temp /= k;
k--;
}
}
System.out.println();
}
}
}