結果
問題 | No.131 マンハッタン距離 |
ユーザー |
![]() |
提出日時 | 2016-11-21 21:49:52 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 136 ms / 5,000 ms |
コード長 | 400 bytes |
コンパイル時間 | 2,050 ms |
コンパイル使用メモリ | 78,876 KB |
実行使用メモリ | 41,680 KB |
最終ジャッジ日時 | 2024-11-27 09:34:14 |
合計ジャッジ時間 | 6,708 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 24 |
ソースコード
import java.util.*;public class Main {public static void main(String[] args) {Scanner sc = new Scanner(System.in);int x = sc.nextInt();int y = sc.nextInt();int d = sc.nextInt();int dx=0;int dy=0;if(d>x){dx=d-x;}if(d>y){dy=d-y;}int ans=d+1-dx-dy;if(ans<0){ans=0;}System.out.println(ans);}}