結果

問題 No.172 UFOを捕まえろ
ユーザー kenji_shioyakenji_shioya
提出日時 2016-06-23 23:37:45
言語 Java21
(openjdk 21)
結果
AC  
実行時間 120 ms / 5,000 ms
コード長 460 bytes
コンパイル時間 3,055 ms
コンパイル使用メモリ 78,568 KB
実行使用メモリ 41,696 KB
最終ジャッジ日時 2024-04-23 14:50:57
合計ジャッジ時間 6,479 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 119 ms
41,220 KB
testcase_01 AC 107 ms
41,408 KB
testcase_02 AC 100 ms
41,328 KB
testcase_03 AC 116 ms
41,448 KB
testcase_04 AC 102 ms
41,300 KB
testcase_05 AC 114 ms
41,484 KB
testcase_06 AC 103 ms
41,148 KB
testcase_07 AC 114 ms
39,844 KB
testcase_08 AC 105 ms
41,576 KB
testcase_09 AC 103 ms
41,132 KB
testcase_10 AC 106 ms
41,040 KB
testcase_11 AC 102 ms
40,116 KB
testcase_12 AC 117 ms
41,000 KB
testcase_13 AC 114 ms
41,204 KB
testcase_14 AC 106 ms
41,696 KB
testcase_15 AC 100 ms
41,564 KB
testcase_16 AC 112 ms
41,256 KB
testcase_17 AC 106 ms
40,924 KB
testcase_18 AC 120 ms
41,484 KB
testcase_19 AC 104 ms
41,244 KB
testcase_20 AC 115 ms
41,232 KB
testcase_21 AC 116 ms
41,400 KB
testcase_22 AC 118 ms
41,612 KB
testcase_23 AC 118 ms
40,248 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Exercise116{
  public static void main (String[] args){

    Scanner sc = new Scanner(System.in);

    int x = Math.abs(sc.nextInt());
    int y = Math.abs(sc.nextInt());
    double r = sc.nextInt();

    double p = Math.sqrt(r * r / 2);
    int pd = 0;
    if(p - Math.floor(p) > 0.5){
      pd = (int)(Math.ceil(p) * 2);
    }else{
      pd = (int)((Math.floor(p) + 0.5) * 2);
    }
    System.out.println(x + y + pd);
  }
}
0