結果
問題 | No.131 マンハッタン距離 |
ユーザー |
![]() |
提出日時 | 2016-02-03 00:24:27 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 50 ms / 5,000 ms |
コード長 | 734 bytes |
コンパイル時間 | 2,198 ms |
コンパイル使用メモリ | 72,844 KB |
実行使用メモリ | 37,084 KB |
最終ジャッジ日時 | 2024-09-21 20:06:24 |
合計ジャッジ時間 | 3,828 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 24 |
ソースコード
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) { BufferedReader stdReader =new BufferedReader(new InputStreamReader(System.in)); try { String[] line = stdReader.readLine().split(" "); int x = Integer.parseInt(line[0]); int y = Integer.parseInt(line[1]); int d = Integer.parseInt(line[2]); int ans = d+1; if(x+y<d){ ans = 0; }else{ if(d>x){ ans -= d-x; } if(d>y){ ans -= d-y; } } System.out.println(ans); } catch (IOException e) { e.printStackTrace(); } } }