[백준/BOJ]28063. 동전 복사 (java) [Bronze 1]

jychan99·2023년 8월 9일
0

  1. 동전 복사

문제출처 : https://www.acmicpc.net/problem/28063

code

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {

    public static void main(String args[]) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st;
        
        int N=Integer.parseInt(br.readLine());
        st = new StringTokenizer(br.readLine());
        int x = Integer.parseInt(st.nextToken());
        int y = Integer.parseInt(st.nextToken());
        int result=0;

        if(N==1){
            result = 0;   
        }else if(x == 1 && y == 1 || x == 1 && y==N || x == N && y == 1 || x == N && y == N){
            result = 2;
        }else if(x == 1 || x == N || y == 1 || y == N){
            result = 3;
        }else{
            result = 4;
        }

        System.out.print(result);

        br.close();
    }
}
profile
내가 지금 두려워 하고 있는 일이 바로 내가 지금 해야 할 일이다. 🐥

0개의 댓글