๐Ÿ•ธ Algorithm/๐Ÿ•ธ ๋ฐฑ์ค€ BaekJoon

[๋ฐฑ์ค€][java][5597][๊ณผ์ œ ์•ˆ ๋‚ด์‹  ๋ถ„..?]

๋‰ด์ด NUEY 2023. 11. 12. 20:21
๋ฐ˜์‘ํ˜•

import java.util.Scanner;

public class Main {
	// 5597	๊ณผ์ œ ์•ˆ ๋‚ด์‹  ๋ถ„..?
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int[] inArr = new int[31];
		
		for (int i = 0; i < 28; i++) {
			inArr[sc.nextInt()] = 1;
		}
		sc.close();
		
		for (int i = 1; i < inArr.length; i++) {
			if (inArr[i] != 1) {
				System.out.println(i);
			}
		}
	}
}
  • ๋ฐฐ์—ด์˜ ์ดˆ๊ธฐ๊ฐ’์ด 0์ด๋ผ๋Š” ์ ์„ ์ด์šฉํ•ด, ๊ณผ์ œ๋ฅผ ๋‚ธ ํ•™์ƒ๋“ค์˜ ๋ฒˆํ˜ธ์— 1์„ ์ฃผ์–ด ํ•ด๊ฒฐํ–ˆ์Šต๋‹ˆ๋‹ค.
๋ฐ˜์‘ํ˜•