結果

問題 No.131 マンハッタン距離
ユーザー spaciaspacia
提出日時 2016-01-11 10:17:23
言語 Java19
(openjdk 21)
結果
AC  
実行時間 56 ms / 5,000 ms
コード長 566 bytes
コンパイル時間 4,215 ms
コンパイル使用メモリ 74,556 KB
実行使用メモリ 53,572 KB
最終ジャッジ日時 2023-10-19 22:46:06
合計ジャッジ時間 5,146 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 55 ms
53,556 KB
testcase_01 AC 54 ms
53,556 KB
testcase_02 AC 55 ms
53,556 KB
testcase_03 AC 55 ms
53,556 KB
testcase_04 AC 54 ms
53,560 KB
testcase_05 AC 54 ms
53,560 KB
testcase_06 AC 54 ms
53,556 KB
testcase_07 AC 55 ms
50,492 KB
testcase_08 AC 55 ms
52,536 KB
testcase_09 AC 55 ms
53,560 KB
testcase_10 AC 56 ms
53,556 KB
testcase_11 AC 55 ms
53,568 KB
testcase_12 AC 54 ms
53,560 KB
testcase_13 AC 54 ms
53,560 KB
testcase_14 AC 56 ms
53,564 KB
testcase_15 AC 54 ms
53,500 KB
testcase_16 AC 55 ms
53,572 KB
testcase_17 AC 56 ms
53,564 KB
testcase_18 AC 55 ms
53,560 KB
testcase_19 AC 55 ms
53,560 KB
testcase_20 AC 54 ms
53,564 KB
testcase_21 AC 54 ms
53,568 KB
testcase_22 AC 55 ms
53,560 KB
testcase_23 AC 55 ms
53,556 KB
testcase_24 AC 55 ms
52,460 KB
testcase_25 AC 56 ms
53,560 KB
testcase_26 AC 55 ms
53,568 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;

class Main {
	
	public static void out (Object o) {
		System.out.println(o);
	}
	
	public static void main (String[] args) throws IOException {
		BufferedReader br = 
			new BufferedReader(new InputStreamReader(System.in));
		
		String[] line = br.readLine().split(" ");
		int x = Integer.parseInt(line[0]);
		int y = Integer.parseInt(line[1]);
		int d = Integer.parseInt(line[2]);
		
		int yMax = d;
		int yMin = x < d ? d - x : 0;
		yMax = Math.min(yMax , y);
		
		int ans = yMax - yMin + 1;
		
		out(ans < 0 ? 0 : ans);
	}
}
0