結果
| 問題 | No.131 マンハッタン距離 | 
| コンテスト | |
| ユーザー |  spacia | 
| 提出日時 | 2016-01-11 10:17:23 | 
| 言語 | Java (openjdk 23) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 47 ms / 5,000 ms | 
| コード長 | 566 bytes | 
| コンパイル時間 | 1,837 ms | 
| コンパイル使用メモリ | 74,756 KB | 
| 実行使用メモリ | 37,196 KB | 
| 最終ジャッジ日時 | 2024-09-19 18:44:39 | 
| 合計ジャッジ時間 | 3,934 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 24 | 
ソースコード
import java.io.*;
import java.util.*;
class Main {
	
	public static void out (Object o) {
		System.out.println(o);
	}
	
	public static void main (String[] args) throws IOException {
		BufferedReader br = 
			new BufferedReader(new InputStreamReader(System.in));
		
		String[] line = br.readLine().split(" ");
		int x = Integer.parseInt(line[0]);
		int y = Integer.parseInt(line[1]);
		int d = Integer.parseInt(line[2]);
		
		int yMax = d;
		int yMin = x < d ? d - x : 0;
		yMax = Math.min(yMax , y);
		
		int ans = yMax - yMin + 1;
		
		out(ans < 0 ? 0 : ans);
	}
}
            
            
            
        