結果
問題 |
No.172 UFOを捕まえろ
|
ユーザー |
![]() |
提出日時 | 2017-06-23 16:43:02 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 122 ms / 5,000 ms |
コード長 | 602 bytes |
コンパイル時間 | 1,934 ms |
コンパイル使用メモリ | 74,652 KB |
実行使用メモリ | 54,316 KB |
最終ジャッジ日時 | 2024-10-03 04:10:54 |
合計ジャッジ時間 | 5,156 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
ソースコード
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 r = sc.nextInt(); int a = 0; for(int i = 1; i <= 200; i++) { if(i * i > 2 * r * r) { a = i; break; } } int s = Math.abs(Math.min(0, x - a - y)); int t = Math.abs(Math.min(0, x - a + y)); int u = Math.abs(Math.max(0, x + a + y)); int v = Math.abs(Math.max(0, x + a - y)); int ans = Math.max(Math.max(s, t), Math.max(u, v)); System.out.println(ans); } }