結果

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

ソースコード

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