結果

問題 No.781 円周上の格子点の数え上げ
ユーザー YamaKasaYamaKasa
提出日時 2019-02-12 21:43:46
言語 Java19
(openjdk 21)
結果
AC  
実行時間 288 ms / 2,000 ms
コード長 484 bytes
コンパイル時間 2,174 ms
コンパイル使用メモリ 71,536 KB
実行使用メモリ 97,800 KB
最終ジャッジ日時 2023-10-11 11:03:09
合計ジャッジ時間 6,850 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 139 ms
97,440 KB
testcase_01 AC 138 ms
97,080 KB
testcase_02 AC 140 ms
97,636 KB
testcase_03 AC 139 ms
96,548 KB
testcase_04 AC 137 ms
97,056 KB
testcase_05 AC 140 ms
97,132 KB
testcase_06 AC 141 ms
96,896 KB
testcase_07 AC 143 ms
96,892 KB
testcase_08 AC 159 ms
97,008 KB
testcase_09 AC 157 ms
97,216 KB
testcase_10 AC 143 ms
96,984 KB
testcase_11 AC 145 ms
97,200 KB
testcase_12 AC 222 ms
96,796 KB
testcase_13 AC 288 ms
97,208 KB
testcase_14 AC 153 ms
97,472 KB
testcase_15 AC 142 ms
97,652 KB
testcase_16 AC 143 ms
97,800 KB
testcase_17 AC 233 ms
96,932 KB
testcase_18 AC 155 ms
97,356 KB
testcase_19 AC 153 ms
96,916 KB
testcase_20 AC 153 ms
97,212 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int X = sc.nextInt();
		int Y = sc.nextInt();
		int[] cnt = new int[10000001];
		for(int x = 0; x * x <= Y; x++) {
			for(int y = 1; y * y <= Y; y++) {
				int k = x * x + y * y;
				if(k >= X && k <= Y) {
					cnt[k]++;
				}
			}
		}
		int ans = 0;
		for(int i = X; i <= Y; i++) {
			ans = Math.max(cnt[i], ans);
		}
		System.out.println(ans * 4);
	}
}
0