forked from sowon-dev/AlgorithmStudy_Java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathc1084singleFor.java
More file actions
84 lines (71 loc) ยท 2.06 KB
/
c1084singleFor.java
File metadata and controls
84 lines (71 loc) ยท 2.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
package codeup100;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.Scanner;
public class c1084singleFor {
public static void main(String[] args) {
//์๊ฐ์ด๊ณผ ๋ฌธ์ ๋ฐ์
/* Scanner sc = new Scanner(System.in);
String[] color = sc.nextLine().split(" ");
sc.close();
int rPick = Integer.parseInt(color[0]);
int gPick = Integer.parseInt(color[1]);
int bPick = Integer.parseInt(color[2]);
int count = 0;
for(int r=0; r<rPick; r++){
for(int g=0; g<gPick; g++){
for(int b=0; b<bPick; b++){
System.out.printf("%d %d %d\n", r,g,b);
count ++;
}
}
}
System.out.println(count);*/
//์๊ฐ ์ด๊ณผ ํด๊ฒฐ
/* BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
try {
String[] n = br.readLine().split(" ");
int count = 0;
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
for (int i = 0; i < Integer.valueOf(n[0]); i++) {
for (int j = 0; j < Integer.valueOf(n[1]); j++) {
for (int k = 0; k < Integer.valueOf(n[2]); k++) {
bw.write(i + " " + j + " " + k + "\n");
count++;
}
}
}
bw.write(String.valueOf(count));
bw.flush();
} catch (NumberFormatException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
*/
//๋จ์ผfor๋ฌธ
Scanner sc = new Scanner(System.in);
String color[] = sc.nextLine().split(" ");
int r = Integer.parseInt(color[0], 10);
int g = Integer.parseInt(color[1], 10);
int b = Integer.parseInt(color[2], 10);
int loop = r * g * b;
int rLoop = g * b;
int gLoop = b;
try(BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out))){
for(int i=0; i<loop; i++){
int colorR = i / rLoop;
int colorG = (i%rLoop) / gLoop;
int colorB = i % b;
bw.write(colorR +" " + colorG + " " + colorB+"\n");
}
bw.write(loop+"");
bw.flush();
}catch(IOException ie){
ie.printStackTrace();
}
}//end of main()
}