結果
| 問題 | No.131 マンハッタン距離 | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2015-05-26 03:24:39 | 
| 言語 | Java (openjdk 23) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 127 ms / 5,000 ms | 
| コード長 | 412 bytes | 
| コンパイル時間 | 3,328 ms | 
| コンパイル使用メモリ | 75,188 KB | 
| 実行使用メモリ | 54,188 KB | 
| 最終ジャッジ日時 | 2024-07-06 08:37:02 | 
| 合計ジャッジ時間 | 7,006 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 24 | 
ソースコード
import java.util.*;
public class Distance {
	public static void main(String[] arg){
		Scanner sc = new Scanner(System.in);
		int x,y,d,res,temp;
		x = sc.nextInt();
		y = sc.nextInt();
		d = sc.nextInt();
		if(d<x){
			if(d<y){
				res = d+1;
			}else{
				res = y + 1;
			}
		}else{
			if(d<y){
				res = x + 1;
			}else{
				res = x + y + 1 - d;
				if(res < 0)res = 0;
			}
		}
		System.out.println(res);
	}
}
            
            
            
        