結果

問題 No.98 円を描こう
ユーザー takeya_okinotakeya_okino
提出日時 2017-07-08 22:49:08
言語 Java21
(openjdk 21)
結果
AC  
実行時間 148 ms / 5,000 ms
コード長 411 bytes
コンパイル時間 2,205 ms
コンパイル使用メモリ 74,228 KB
実行使用メモリ 41,564 KB
最終ジャッジ日時 2024-04-16 06:39:46
合計ジャッジ時間 4,359 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 137 ms
41,196 KB
testcase_01 AC 140 ms
41,360 KB
testcase_02 AC 148 ms
41,564 KB
testcase_03 AC 140 ms
41,436 KB
testcase_04 AC 137 ms
41,204 KB
testcase_05 AC 141 ms
41,336 KB
testcase_06 AC 140 ms
41,520 KB
testcase_07 AC 138 ms
41,416 KB
testcase_08 AC 142 ms
41,468 KB
testcase_09 AC 140 ms
41,212 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int xp = sc.nextInt();
    int yp = sc.nextInt();
    int s = xp * xp + yp * yp;
    int r = (int)Math.sqrt(s);
    int ans = 0;
    for(int i = 2 * r; i <= 2 * r + 4; i++) {
      if(i * i > 4 * s) {
        ans = i;
        break; 
      }
    }
    System.out.println(ans);
  }
}
0