[백준] 3003번 킹, 퀸, 룩, 비숍, 나이트, 폰 문제풀이 | Java | 자바

BeyondTheClouds·2025년 1월 11일

BAEKJOON | Java

목록 보기
119/140

안녕하세요. BeyondTheClouds 입니다.

Problem.

이번에 풀어볼 문제는 3003번 킹, 퀸, 룩, 비숍, 나이트, 폰 입니다.

Code.

제가 작성한 코드는 아래와 같습니다.

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int k = sc.nextInt();
        int q = sc.nextInt();
        int l = sc.nextInt();
        int b = sc.nextInt();
        int n = sc.nextInt();
        int p = sc.nextInt();

        System.out.print((1 - k) + " ");
        System.out.print((1 - q) + " ");
        System.out.print((2 - l) + " ");
        System.out.print((2 - b) + " ");
        System.out.print((2 - n) + " ");
        System.out.print(8 - p);
    }
}

마지막으로 위 문제의 링크 남겨두도록 하겠습니다!
https://www.acmicpc.net/problem/3003

★ 제가 푼 방법이 항상 정답은 아닙니다. 더 좋은 방법이 있다면 댓글로 알려주세요! ★

profile
개발자가 되고싶어요

0개의 댓글