結果

問題 No.131 マンハッタン距離
ユーザー tenten
提出日時 2020-10-15 17:31:14
言語 Java
(openjdk 23)
結果
AC  
実行時間 146 ms / 5,000 ms
コード長 313 bytes
コンパイル時間 2,369 ms
コンパイル使用メモリ 74,536 KB
実行使用メモリ 41,464 KB
最終ジャッジ日時 2024-07-20 19:49:53
合計ジャッジ時間 7,461 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int y = sc.nextInt();
		int d = sc.nextInt();
		int start = Math.max(0, d - x);
		int end = Math.min(y, d);
		System.out.println(Math.max(end - start + 1, 0));
	}
}
0