結果

問題 No.781 円周上の格子点の数え上げ
ユーザー kokatsukokatsu
提出日時 2022-11-09 22:17:48
言語 D
(dmd 2.107.1)
結果
AC  
実行時間 136 ms / 2,000 ms
コード長 380 bytes
コンパイル時間 1,859 ms
コンパイル使用メモリ 200,632 KB
実行使用メモリ 83,156 KB
最終ジャッジ日時 2023-09-04 18:54:37
合計ジャッジ時間 3,851 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,384 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,384 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,384 KB
testcase_08 AC 131 ms
81,652 KB
testcase_09 AC 127 ms
83,156 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 133 ms
81,808 KB
testcase_13 AC 136 ms
82,204 KB
testcase_14 AC 4 ms
7,924 KB
testcase_15 AC 2 ms
4,384 KB
testcase_16 AC 1 ms
4,380 KB
testcase_17 AC 75 ms
50,268 KB
testcase_18 AC 66 ms
50,512 KB
testcase_19 AC 70 ms
51,724 KB
testcase_20 AC 69 ms
51,256 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import std;

void main() {
    long X, Y;
    readf("%d %d\n", X, Y);

    auto cnts = new long[](Y+1);
    foreach (i; 1 .. Y+1) {
        long u = i * i;
        if (u > Y) break;

        foreach (j; 0 .. Y+1) {
            long v = j * j;
            if (u + v > Y) break;

            ++cnts[u+v];
        }
    }

    long res = cnts[X..$].maxElement * 4;
    res.writeln;
}
0