結果

問題 No.131 マンハッタン距離
ユーザー tsunabittsunabit
提出日時 2020-03-03 22:26:48
言語 Java21
(openjdk 21)
結果
AC  
実行時間 1,242 ms / 5,000 ms
コード長 390 bytes
コンパイル時間 4,518 ms
コンパイル使用メモリ 74,528 KB
実行使用メモリ 41,728 KB
最終ジャッジ日時 2024-04-22 00:41:37
合計ジャッジ時間 12,752 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 136 ms
41,356 KB
testcase_01 AC 135 ms
41,584 KB
testcase_02 AC 137 ms
41,192 KB
testcase_03 AC 252 ms
41,444 KB
testcase_04 AC 220 ms
41,592 KB
testcase_05 AC 201 ms
41,596 KB
testcase_06 AC 153 ms
41,552 KB
testcase_07 AC 134 ms
41,156 KB
testcase_08 AC 133 ms
41,676 KB
testcase_09 AC 135 ms
41,652 KB
testcase_10 AC 137 ms
41,464 KB
testcase_11 AC 135 ms
41,380 KB
testcase_12 AC 134 ms
41,524 KB
testcase_13 AC 136 ms
41,452 KB
testcase_14 AC 134 ms
41,396 KB
testcase_15 AC 135 ms
41,532 KB
testcase_16 AC 134 ms
41,452 KB
testcase_17 AC 135 ms
41,728 KB
testcase_18 AC 136 ms
41,436 KB
testcase_19 AC 139 ms
41,340 KB
testcase_20 AC 137 ms
41,676 KB
testcase_21 AC 137 ms
41,296 KB
testcase_22 AC 134 ms
41,492 KB
testcase_23 AC 986 ms
41,392 KB
testcase_24 AC 1,242 ms
41,552 KB
testcase_25 AC 893 ms
41,608 KB
testcase_26 AC 892 ms
41,700 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

public class No131 {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt(), y = sc.nextInt(), d = sc.nextInt();
		int a = 0;
		if(d == 0) {
			System.out.println(1);
			return;
		}
		for(int i = 0; i <= x; i++) {
			if(y >= d-i && (d-i) >= 0) a++;
		}
		System.out.println(a);
	}
}
0