結果

問題 No.965 門松列が嫌い
ユーザー uwiuwi
提出日時 2020-01-13 19:24:29
言語 Java19
(openjdk 21)
結果
AC  
実行時間 110 ms / 1,000 ms
コード長 1,126 bytes
コンパイル時間 3,369 ms
コンパイル使用メモリ 75,288 KB
実行使用メモリ 39,592 KB
最終ジャッジ日時 2023-08-23 11:53:47
合計ジャッジ時間 5,151 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 107 ms
39,200 KB
testcase_01 AC 108 ms
39,140 KB
testcase_02 AC 110 ms
39,124 KB
testcase_03 AC 107 ms
39,268 KB
testcase_04 AC 107 ms
39,084 KB
testcase_05 AC 109 ms
39,352 KB
testcase_06 AC 109 ms
38,832 KB
testcase_07 AC 109 ms
39,072 KB
testcase_08 AC 109 ms
39,592 KB
testcase_09 AC 106 ms
39,536 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package contest200113;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

public class B {
	static Scanner in;
	static PrintWriter out;
	static String INPUT = "";
	
	static void solve()
	{
		int A = ni(), B = ni(), C = ni();
		if(!(1 <= A && A <= 1000000000))throw new RuntimeException();
		if(!(1 <= B && B <= 1000000000))throw new RuntimeException();
		if(!(1 <= C && C <= 1000000000))throw new RuntimeException();
		if(!(B < A && A < C || C < A && A < B || B < C && C < A || A < C && C < B)) {
			throw new RuntimeException();
		}
		out.println(Math.min(Math.min(Math.abs(A-B), Math.abs(B-C)), Math.abs(C-A)));
	}
	
	public static void main(String[] args) throws Exception
	{
		in = INPUT.isEmpty() ? new Scanner(System.in) : new Scanner(INPUT);
		out = new PrintWriter(System.out);
		
		solve();
		out.flush();
	}
	
	static int ni() { return Integer.parseInt(in.next()); }
	static long nl() { return Long.parseLong(in.next()); }
	static double nd() { return Double.parseDouble(in.next()); }
	static void tr(Object... o) { if(INPUT.length() != 0)System.out.println(Arrays.deepToString(o)); }
}
0