結果

問題 No.98 円を描こう
ユーザー villachvillach
提出日時 2017-09-29 16:43:35
言語 Java21
(openjdk 21)
結果
AC  
実行時間 124 ms / 5,000 ms
コード長 401 bytes
コンパイル時間 3,688 ms
コンパイル使用メモリ 74,556 KB
実行使用メモリ 54,092 KB
最終ジャッジ日時 2024-04-27 16:20:24
合計ジャッジ時間 4,745 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 108 ms
52,664 KB
testcase_01 AC 121 ms
53,832 KB
testcase_02 AC 124 ms
53,980 KB
testcase_03 AC 124 ms
54,092 KB
testcase_04 AC 123 ms
53,932 KB
testcase_05 AC 108 ms
52,728 KB
testcase_06 AC 108 ms
52,936 KB
testcase_07 AC 116 ms
53,908 KB
testcase_08 AC 106 ms
52,836 KB
testcase_09 AC 114 ms
53,336 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package yukicoder;

import java.util.Scanner;

public class N98 {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int y = sc.nextInt();
		double r = Math.abs(Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2)));
		if(r % 1 == 0){
			System.out.println((int) Math.round(r) * 2 + 1);
		}else{
			System.out.println((int) Math.floor(r * 2) + 1);
		}
	}
}
0