A-B
ํ์ด
- BufferedReader, BufferedWriter ํด๋์ค ์ฌ์ฉํ์ฌ ํ์ดํ์๋ค.
- br.readLine() ์
๋ ฅ ๋ฐ์ ํ ์ค์ ์
๋ ฅ๋ฐ๋๋ค.
- BufferedWriter์ ๊ฒฝ์ฐ write()๋ฅผ ํตํด ์ถ๋ ฅ ๋ฒํผ์ ์ ์ฅํ๊ณ , flush()๋ฅผ ์ฌ์ฉํ๋ฉด ์ถ๋ ฅํ๋ค.
์ ์ถ ์ฝ๋
import java.io.*;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
String str = br.readLine();
StringTokenizer st = new StringTokenizer(str, " ");
int a = Integer.parseInt(st.nextToken());
int b = Integer.parseInt(st.nextToken());
bw.write(String.valueOf(a-b));
bw.flush();
}
}