๋ชฉ์ฐจ
1. ๋ฌธ์



2. ๋ง์ถ์ฝ๋
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.StringTokenizer;
public class bj5597{
public static void main(String[] args) throws IOException{
/*
1~30๊น์ง ์ถ์๋ฒํธ
์ ์ถ์ํ ์ถ์๋ฒํธ ๊ตฌํ๊ธฐ
*/
// ์์ฑ์ ๋ฐ ๋ณ์ ์์ฑ
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st;
int student = 30; //-- ์ดํ์์
int[] arr = new int[student]; //-- ํ์์๋งํผ์ ๋ฐฐ์ด์์ฑ
// ์
๋ ฅ๋ฐ๊ธฐ
for(int i=0; i<student-2; i++){ //-- ์ ์ถํ ํ์์ ๋งํผ ๋ฐ๋ณต
st = new StringTokenizer(br.readLine());
int stu_in = Integer.parseInt(st.nextToken()); //-- ์ ์ถํ ํ์์ ๋ฒํธ
arr[stu_in-1] = 1; //-- ์ ์ถํ ๊ฒฝ์ฐ 1
//-- ใstu_in-1ใ → ๋ฐฐ์ด์ 0๋ถํฐ ์์์ด๋ฏ๋ก ๋ฐฐ์ด์ ์
๋ ฅ์ -1 ์ถ๊ฐ
};
// ํ์ธ ๋ฐ ์ถ๋ ฅ
for(int i=0; i<student; i++){
if(arr[i]!=1)
System.out.println(i+1); //-- ใi+1ใ → ๋ฐฐ์ด์ 0๋ถํฐ ์์์ด๋ฏ๋ก ์ถ๋ ฅ์ +1 ์ถ๊ฐ
};
}
}'๐ป ๋ฌธ์ ํ๊ณ ์ ๋ฆฌํ๊ธฐ + > ๋ฐฑ์ค' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
| [๋ฐฑ์ค Java] 1546: ํ๊ท (2) | 2023.09.09 |
|---|---|
| [๋ฐฑ์ค Java] 3052: ๋๋จธ์ง (0) | 2023.09.07 |
| [๋ฐฑ์ค Java] 10813: ๊ณต ๋ฐ๊พธ๊ธฐ (1) | 2023.09.06 |
| [๋ฐฑ์ค Java] 10810: ๊ณต ๋ฃ๊ธฐ (0) | 2023.09.06 |
| [๋ฐฑ์ค Java] 2562: ์ต๋๊ฐ (1) | 2023.09.05 |