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

[๋ฐฑ์ค€][java][3003][ํ‚น, ํ€ธ, ๋ฃฉ, ๋น„์ˆ, ๋‚˜์ดํŠธ, ํฐ]

๋‰ด์ด NUEY 2024. 2. 3. 01:53
๋ฐ˜์‘ํ˜•

import java.util.Scanner;

public class Main {
	// 	3003	ํ‚น, ํ€ธ, ๋ฃฉ, ๋น„์ˆ, ๋‚˜์ดํŠธ, ํฐ
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		
		int[] chess = {1, 1, 2, 2, 2, 8};
		int[] cnt = new int[6];
		
		for (int i = 0; i < cnt.length; i++) {
			cnt[i] = in.nextInt();
			
			System.out.print(chess[i] - cnt[i] + " ");
		}
		in.close();
	}
}

 

  • ๋ฐฐ์—ด์— chess ๊ฐ’์„ ๋ฏธ๋ฆฌ ์ž…๋ ฅํ•œ ํ›„
  • ์ž…๋ ฅ๊ฐ’๊ณผ ๋น„๊ต๋งŒ ํ•˜๋ฉด ๋ฉ๋‹ˆ๋‹ค.
๋ฐ˜์‘ํ˜•