結果

問題 No.98 円を描こう
ユーザー villach
提出日時 2017-09-29 16:43:35
言語 Java
(openjdk 23)
結果
AC  
実行時間 136 ms / 5,000 ms
コード長 401 bytes
コンパイル時間 3,738 ms
コンパイル使用メモリ 77,440 KB
実行使用メモリ 41,672 KB
最終ジャッジ日時 2024-11-15 19:55:05
合計ジャッジ時間 5,373 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 6
権限があれば一括ダウンロードができます

ソースコード

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