結果

問題 No.131 マンハッタン距離
ユーザー kou6839
提出日時 2015-02-22 23:27:11
言語 Java
(openjdk 23)
結果
AC  
実行時間 134 ms / 5,000 ms
コード長 382 bytes
コンパイル時間 2,561 ms
コンパイル使用メモリ 74,496 KB
実行使用メモリ 54,472 KB
最終ジャッジ日時 2024-06-23 21:54:31
合計ジャッジ時間 6,976 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

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

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();
		
		if(x+y<d){
			System.out.println(0);
			
		}else if(x>=d && y>=d){
			System.out.println(d+1);
		}else{
			System.out.println(d+1-Math.max(0,d-x)-Math.max(0,d-y));
		}
	}
}
0