結果

問題 No.98 円を描こう
ユーザー scache
提出日時 2014-12-09 23:39:41
言語 Java
(openjdk 23)
結果
AC  
実行時間 119 ms / 5,000 ms
コード長 441 bytes
コンパイル時間 2,944 ms
コンパイル使用メモリ 74,616 KB
実行使用メモリ 54,444 KB
最終ジャッジ日時 2024-06-11 19:03:37
合計ジャッジ時間 4,664 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 6
権限があれば一括ダウンロードができます

ソースコード

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