Skip to content

Commit 3b57530

Browse files
committed
[Bronze III] Title: 과제 안 내신 분..?, Time: 172 ms, Memory: 17680 KB -BaekjoonHub
1 parent f3acc90 commit 3b57530

File tree

2 files changed

+67
-0
lines changed

2 files changed

+67
-0
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# [Bronze III] 과제 안 내신 분..? - 5597
2+
3+
[문제 링크](https://www.acmicpc.net/problem/5597)
4+
5+
### 성능 요약
6+
7+
메모리: 17680 KB, 시간: 172 ms
8+
9+
### 분류
10+
11+
구현
12+
13+
### 제출 일자
14+
15+
2025년 1월 23일 03:01:37
16+
17+
### 문제 설명
18+
19+
<p>X대학 M교수님은 프로그래밍 수업을 맡고 있다. 교실엔 학생이 30명이 있는데, 학생 명부엔 각 학생별로 1번부터 30번까지 출석번호가 붙어 있다.</p>
20+
21+
<p>교수님이 내준 특별과제를 28명이 제출했는데, 그 중에서 제출 안 한 학생 2명의 출석번호를 구하는 프로그램을 작성하시오.</p>
22+
23+
### 입력
24+
25+
<p>입력은 총 28줄로 각 제출자(학생)의 출석번호 n(1 ≤ n ≤ 30)가 한 줄에 하나씩 주어진다. 출석번호에 중복은 없다.</p>
26+
27+
### 출력
28+
29+
<p>출력은 2줄이다. 1번째 줄엔 제출하지 않은 학생의 출석번호 중 가장 작은 것을 출력하고, 2번째 줄에선 그 다음 출석번호를 출력한다.</p>
30+
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import java.util.Scanner;
2+
3+
//TIP To <b>Run</b> code, press <shortcut actionId="Run"/> or
4+
// click the <icon src="AllIcons.Actions.Execute"/> icon in the gutter.
5+
public class Main {
6+
public static void main(String[] args) {
7+
Scanner scanner = new Scanner(System.in);
8+
// int n = scanner.nextInt();
9+
int[] arr = new int[31];
10+
11+
for(int i=1; i<31; i++){
12+
arr[i] = 0;
13+
}
14+
15+
for(int i=0; i<28; i++){
16+
int num = scanner.nextInt();
17+
arr[num] = num;
18+
}
19+
20+
// for(int i=1; i<31; i++){
21+
// System.out.println(arr[i]);
22+
// }
23+
24+
int a = 0;
25+
int b = 0;
26+
for(int i=1; i<31; i++){
27+
if(a == 0 && arr[i] == 0){
28+
a = i;
29+
}else if(b == 0 && arr[i] == 0){
30+
b = i;
31+
}
32+
}
33+
34+
System.out.println(a);
35+
System.out.println(b);
36+
}
37+
}

0 commit comments

Comments
 (0)