結果

問題 No.781 円周上の格子点の数え上げ
ユーザー potoooooooopotoooooooo
提出日時 2019-01-30 00:05:29
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 167 ms / 2,000 ms
コード長 419 bytes
コンパイル時間 1,905 ms
コンパイル使用メモリ 164,252 KB
実行使用メモリ 81,368 KB
最終ジャッジ日時 2024-04-20 06:51:41
合計ジャッジ時間 3,543 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 3 ms
5,376 KB
testcase_07 AC 3 ms
5,376 KB
testcase_08 AC 167 ms
81,280 KB
testcase_09 AC 142 ms
81,300 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 3 ms
5,376 KB
testcase_12 AC 144 ms
81,280 KB
testcase_13 AC 152 ms
81,368 KB
testcase_14 AC 7 ms
7,776 KB
testcase_15 AC 2 ms
5,376 KB
testcase_16 AC 2 ms
5,376 KB
testcase_17 AC 81 ms
49,664 KB
testcase_18 AC 74 ms
49,652 KB
testcase_19 AC 77 ms
51,072 KB
testcase_20 AC 80 ms
50,812 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main() {
    int x, y; cin >> x >> y;
    vector<long long> v(y+1, 0);
    for (int i = 0; i * i <= y; i++) {
        for (int j = 1; j * j <= y; j++) {
            if (i*i+j*j > y) break;
            v[i*i+j*j]++;
        }
    }
    long long ans = 0;
    for (int i = x; i <= y; i++) {
        ans = max(ans, v[i]);
    }
    cout << ans * 4 << endl;
    return 0;
}
0