結果

問題 No.965 門松列が嫌い
ユーザー ks2m
提出日時 2020-01-13 20:38:22
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 600 bytes
コンパイル時間 2,848 ms
コンパイル使用メモリ 75,080 KB
実行使用メモリ 50,024 KB
最終ジャッジ日時 2024-12-21 16:25:06
合計ジャッジ時間 3,463 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 5 WA * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] sa = br.readLine().split(" ");
		int a = Integer.parseInt(sa[0]);
		int b = Integer.parseInt(sa[1]);
		int c = Integer.parseInt(sa[2]);
		br.close();

		if (a <= b && b <= c || c <= b && b <= a) {
			System.out.println(0);
			return;
		}
		if (a <= b) {
			System.out.println(Math.min(b - a, b - c));
		} else {
			System.out.println(Math.min(a - b, c - b));
		}
	}
}
0