結果

問題 No.131 マンハッタン距離
ユーザー rf141
提出日時 2015-08-06 00:00:32
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 345 bytes
コンパイル時間 3,475 ms
コンパイル使用メモリ 74,808 KB
実行使用メモリ 54,400 KB
最終ジャッジ日時 2024-07-18 03:33:52
合計ジャッジ時間 7,830 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 7 WA * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
public class Distance{
	public static void main(String... args){
		Scanner scan = new Scanner(System.in);
		int x = scan.nextInt();
		int y = scan.nextInt();
		int d = scan.nextInt();
		if(x+y<d){
			System.out.println(0);
			return;
		}
		int dx = (d <= x)? d:x;
		int dy = (d <= y)? d:y;
		System.out.println(1+dx-dy);
	}
}
0