Skip to content

Commit 0fac725

Browse files
committed
c1098ing
1 parent d1ba8c8 commit 0fac725

4 files changed

Lines changed: 120 additions & 3 deletions

File tree

โ€Žsrc/codeup100/c1095.javaโ€Ž

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
11
package codeup100;
22

33
import java.util.Scanner;
4-
//10 4 2 3 6 6 7 9 8 5
4+
55
public class c1095 {
66

77
public static void main(String[] args) {
88
Scanner sc = new Scanner(System.in);
9-
int count = sc.nextInt();
9+
int count = sc.nextInt(); //๋ฒˆํ˜ธ๋ฅผ ๋ถ€๋ฅธ ํšŸ์ˆ˜
10+
11+
//10
12+
//10 4 2 3 6 6 7 9 8 5
1013

1114
int numbers = 0;
1215
int min = 0;
1316
for (int i = 0; i < count; i++) {
14-
numbers = sc.nextInt();
17+
numbers = sc.nextInt(); //count๊ฐœ์˜ ๋žœ๋ค๋ฒˆํ˜ธ
1518

1619
if (i == 0) {
1720
min = numbers;
@@ -21,5 +24,6 @@ public static void main(String[] args) {
2124

2225
}
2326
System.out.println(min);
27+
sc.close();
2428
}
2529
}

โ€Žsrc/codeup100/c1096.javaโ€Ž

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package codeup100;
2+
3+
import java.util.Scanner;
4+
5+
public class c1096 {
6+
public static void main(String[] args) {
7+
Scanner sc = new Scanner(System.in);
8+
9+
//๋ฐ”๋‘‘ํŒ์— ์˜ฌ๋ ค ๋†“์„ ํฐ ๋Œ์˜ ๊ฐœ์ˆ˜(n)๊ฐ€ ์ฒซ ์ค„์— ์ž…๋ ฅ๋œ๋‹ค.
10+
//๋‘˜์งธ ์ค„ ๋ถ€ํ„ฐ n+1 ๋ฒˆ์งธ ์ค„๊นŒ์ง€ ํžŒ ๋Œ์„ ๋†“์„ ์ขŒํ‘œ(x, y)๊ฐ€ n์ค„ ์ž…๋ ฅ๋œ๋‹ค.
11+
//n์€ 10์ดํ•˜์˜ ์ž์—ฐ์ˆ˜์ด๊ณ  x, y ์ขŒํ‘œ๋Š” 1 ~ 19 ๊นŒ์ง€์ด๋ฉฐ, ๊ฐ™์€ ์ขŒํ‘œ๋Š” ์ž…๋ ฅ๋˜์ง€ ์•Š๋Š”๋‹ค.
12+
13+
int count = sc.nextInt(); // ๋ฐ”๋‘‘ํŒ์— ์˜ฌ๋ ค ๋†“์„ ํฐ ๋Œ์˜ ๊ฐœ์ˆ˜(n)
14+
int[][] arr = new int[19][19]; //2์ฐจ์›๋ฐฐ์—ด์ƒ์„ฑ
15+
16+
for(int i=0; i<count; i++){
17+
int x=sc.nextInt();
18+
int y=sc.nextInt();
19+
arr[x-1][y-1] = 1;
20+
}
21+
sc.close();
22+
23+
//์ถœ๋ ฅ
24+
for (int i=0; i<arr.length; i++){
25+
for (int j=0; j<arr.length; j++){
26+
System.out.printf("%d ", arr[i][j]);
27+
}
28+
System.out.println();
29+
}
30+
}
31+
}

โ€Žsrc/codeup100/c1097.javaโ€Ž

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
package codeup100;
2+
3+
import java.util.Scanner;
4+
5+
public class c1097 {
6+
public static void main(String[] args) {
7+
Scanner sc = new Scanner(System.in);
8+
int[][] arr = new int[19][19]; //2์ฐจ์›๋ฐฐ์—ด์ƒ์„ฑ
9+
10+
//์ž…๋ ฅ๊ฐ’ ๋ฐฐ์—ด์— ๋„ฃ๊ธฐ
11+
for(int i=0; i<arr.length; i++){
12+
for(int j=0; j<arr.length; j++){
13+
arr[i][j] = sc.nextInt();
14+
//System.out.printf("%d ",arr[i][j]);
15+
}
16+
//System.out.println();
17+
}
18+
19+
int count = sc.nextInt(); // ์‹ญ์ž ๋’ค์ง‘๊ธฐ ํšŸ์ˆ˜(n)
20+
21+
//1์ด๋ฉด 0์œผ๋กœ 0์ด๋ฉด 1๋กœ
22+
for(int n=0; n<count; n++){
23+
int x = sc.nextInt()-1; //10 12
24+
int y = sc.nextInt()-1; //10 12
25+
26+
//[10, i]๊ฐ€ 0์ด๋ฉด 1๋กœ, 1์ด๋ฉด 0์œผ๋กœ
27+
for(int i=0; i<arr.length; i++){
28+
if(arr[x][i] == 0){
29+
arr[x][i] = 1;
30+
}else{
31+
arr[x][i] = 0;
32+
}
33+
}
34+
35+
//[j, 10]๊ฐ€ 0์ด๋ฉด 1๋กœ, 1์ด๋ฉด 0์œผ๋กœ
36+
for(int j=0; j<arr.length; j++){
37+
if(arr[j][y] == 0){
38+
arr[j][y] = 1;
39+
}else{
40+
arr[j][y] = 0;
41+
}
42+
}
43+
}
44+
sc.close();
45+
46+
//๋‹ต ์ถœ๋ ฅ
47+
for(int i=0; i<arr.length; i++){
48+
for(int j=0; j<arr.length; j++){
49+
System.out.printf("%d ", arr[i][j]);
50+
}
51+
System.out.println();
52+
}
53+
54+
}//end of main
55+
}

โ€Žsrc/codeup100/c1098.javaโ€Ž

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package codeup100;
2+
3+
import java.util.Scanner;
4+
5+
public class c1098 {
6+
public static void main(String[] args) {
7+
Scanner sc = new Scanner(System.in);
8+
9+
//์ฒซ ์ค„์— ๊ฒฉ์žํŒ์˜ ์„ธ๋กœ(h), ๊ฐ€๋กœ(w) ๊ฐ€ ๊ณต๋ฐฑ์„ ๋‘๊ณ  ์ž…๋ ฅ๋˜๊ณ ,
10+
int h = sc.nextInt();
11+
int w = sc.nextInt();
12+
int[][] arr = new int[h][w];
13+
14+
//๋‘ ๋ฒˆ์งธ ์ค„์— ๋†“์„ ์ˆ˜ ์žˆ๋Š” ๋ง‰๋Œ€์˜ ๊ฐœ์ˆ˜(n)
15+
int n = sc.nextInt(); //3
16+
17+
//์„ธ ๋ฒˆ์งธ ์ค„๋ถ€ํ„ฐ ๊ฐ ๋ง‰๋Œ€์˜ ๊ธธ์ด(l), ๋ฐฉํ–ฅ(d), ์ขŒํ‘œ(x, y)๊ฐ€ ์ž…๋ ฅ๋œ๋‹ค.
18+
// 2 0 1 1
19+
int l = sc.nextInt();
20+
int d = sc.nextInt();
21+
int x = sc.nextInt();
22+
int y = sc.nextInt();
23+
24+
25+
sc.close();
26+
}
27+
}

0 commit comments

Comments
ย (0)