본문 바로가기
Baekjoon Online Judge

[BOJ] 백준 3003번 킹, 퀸, 룩, 비숍, 나이트, 폰 (Java)

by 프로그래 밍구 2022. 11. 10.

문제링크

https://www.acmicpc.net/problem/3003

 

3003번: 킹, 퀸, 룩, 비숍, 나이트, 폰

첫째 줄에 동혁이가 찾은 흰색 킹, 퀸, 룩, 비숍, 나이트, 폰의 개수가 주어진다. 이 값은 0보다 크거나 같고 10보다 작거나 같은 정수이다.

www.acmicpc.net


나의코드

import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int king = 1;
        int queen = 1;
        int rook = 2;
        int bishop =2;
        int knight = 2;
        int pawn = 8;
        
        System.out.print(king - sc.nextInt()+ " ");
        System.out.print(queen - sc.nextInt()+ " ");
        System.out.print(rook - sc.nextInt()+ " ");
        System.out.print(bishop - sc.nextInt()+ " ");
        System.out.print(knight - sc.nextInt()+ " ");
        System.out.print(pawn - sc.nextInt());
        sc.close();
    }
}

 

댓글