結果
問題 | No.131 マンハッタン距離 |
ユーザー |
![]() |
提出日時 | 2015-04-06 10:56:38 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 132 ms / 5,000 ms |
コード長 | 741 bytes |
コンパイル時間 | 2,380 ms |
コンパイル使用メモリ | 74,500 KB |
実行使用メモリ | 54,528 KB |
最終ジャッジ日時 | 2024-07-04 03:22:15 |
合計ジャッジ時間 | 6,208 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 24 |
ソースコード
import java.util.Scanner; public class Main { public static void main(String[] args) throws Exception { Scanner koko = new Scanner(System.in); int x = koko.nextInt(); int y = koko.nextInt(); int d = koko.nextInt(); int point; if(d>x+y){ point = 0; }else if(x<y){ if(d<x){ point=d+1; }else if(x<=d&&d<=y){ point=x+1; }else{ point = x+y+1-d; } }else{ if(d<y){ point=d+1; }else if(y<=d&&d<=x){ point = y+1; }else{ point = x+y+1-d; } } System.out.println(point); } }