結果

問題 No.98 円を描こう
ユーザー l1267976l1267976
提出日時 2017-03-19 15:36:01
言語 Java21
(openjdk 21)
結果
AC  
実行時間 135 ms / 5,000 ms
コード長 490 bytes
コンパイル時間 3,466 ms
コンパイル使用メモリ 71,928 KB
実行使用メモリ 57,884 KB
最終ジャッジ日時 2023-09-18 07:28:22
合計ジャッジ時間 5,111 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 132 ms
55,888 KB
testcase_01 AC 135 ms
56,048 KB
testcase_02 AC 133 ms
56,192 KB
testcase_03 AC 134 ms
56,368 KB
testcase_04 AC 135 ms
56,492 KB
testcase_05 AC 134 ms
56,032 KB
testcase_06 AC 133 ms
55,676 KB
testcase_07 AC 134 ms
57,884 KB
testcase_08 AC 133 ms
56,208 KB
testcase_09 AC 133 ms
56,052 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class No98 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        double x = sc.nextDouble();
        double y = sc.nextDouble();

        double hypo = Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2));

        double diameter = hypo * 2;

        if (diameter - Math.floor(diameter) == 0) {
            diameter += 1;
        }

        System.out.println((int) Math.ceil(diameter));

        sc.close();
    }

}
0