Algorithm

[Java] 백준 3046번 R2

로춘남 2021. 11. 2. 19:00
728x90


입출력 문제. Buffer와 StringTokenizer 사용

 

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));
        String str = br.readLine();
        StringTokenizer st = new StringTokenizer(str, " ");
        int R1 = Integer.parseInt(st.nextToken());
        int S = Integer.parseInt(st.nextToken());

        int R2 = 2*S - R1;
        System.out.println(R2);

    }
}
728x90