結果

問題 No.98 円を描こう
ユーザー scachescache
提出日時 2014-12-09 23:39:41
言語 Java21
(openjdk 21)
結果
AC  
実行時間 132 ms / 5,000 ms
コード長 441 bytes
コンパイル時間 3,156 ms
コンパイル使用メモリ 72,176 KB
実行使用メモリ 56,092 KB
最終ジャッジ日時 2023-09-02 12:21:40
合計ジャッジ時間 5,212 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
55,768 KB
testcase_01 AC 121 ms
55,748 KB
testcase_02 AC 122 ms
55,988 KB
testcase_03 AC 122 ms
55,596 KB
testcase_04 AC 129 ms
55,528 KB
testcase_05 AC 132 ms
55,604 KB
testcase_06 AC 132 ms
56,092 KB
testcase_07 AC 132 ms
55,812 KB
testcase_08 AC 124 ms
55,948 KB
testcase_09 AC 123 ms
55,768 KB
権限があれば一括ダウンロードができます

ソースコード

diff #


import java.util.Scanner;

public class Main98 {
	public static void main(String[] args) {
		Main98 p = new Main98();
	}

	public Main98() {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int y = sc.nextInt();
		solve(x, y);
	}

	public void solve(int x, int y) {
		x*=2; y*=2;
		double r = Math.ceil(Math.sqrt(x*x+y*y));
		if(x*x+y*y == (int)(r*r))
			r++;

		System.out.println((int)r);
	}

}
0