結果

問題 No.98 円を描こう
ユーザー shinshin
提出日時 2022-06-05 17:13:45
言語 Java21
(openjdk 21)
結果
AC  
実行時間 58 ms / 5,000 ms
コード長 860 bytes
コンパイル時間 3,753 ms
コンパイル使用メモリ 76,168 KB
実行使用メモリ 53,888 KB
最終ジャッジ日時 2023-10-21 03:13:58
合計ジャッジ時間 5,210 ms
ジャッジサーバーID
(参考情報)
judge9 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 56 ms
53,888 KB
testcase_01 AC 57 ms
52,852 KB
testcase_02 AC 57 ms
53,852 KB
testcase_03 AC 57 ms
53,852 KB
testcase_04 AC 58 ms
53,860 KB
testcase_05 AC 55 ms
52,760 KB
testcase_06 AC 57 ms
53,864 KB
testcase_07 AC 55 ms
53,852 KB
testcase_08 AC 58 ms
53,864 KB
testcase_09 AC 55 ms
52,788 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;

public class No98 {

	public static void main(String[] args) throws IOException{
		//円を描こう
		String[] str = readStr()[0].split(" ");
		double X = Double.parseDouble(str[0]) , Y = Double.parseDouble(str[1]);
		
		double R = Math.sqrt(X * X + Y * Y);
		
		int D;
		if(R == Math.ceil(R)) {
			D = (int)R * 2 + 1;
		}else {
			D = (int)Math.ceil(R * 2);
		}
		
		System.out.println(D);
		
		
	}

	public static String[] readStr() throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		ArrayList<String> list = new ArrayList<>();

		do {
			list.add(br.readLine());
		}while(br.ready());

		br.close();

		String[] text = new String[list.size()];
		list.toArray(text);

		return text;

	}
}
0