結果

問題 No.781 円周上の格子点の数え上げ
ユーザー coco18000coco18000
提出日時 2019-01-11 22:04:45
言語 C++14
(gcc 12.2.0 + boost 1.81.0)
結果
AC  
実行時間 140 ms / 2,000 ms
コード長 675 bytes
コンパイル時間 2,610 ms
コンパイル使用メモリ 163,960 KB
実行使用メモリ 81,472 KB
最終ジャッジ日時 2023-08-20 06:29:43
合計ジャッジ時間 4,045 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 3 ms
4,376 KB
testcase_08 AC 133 ms
81,460 KB
testcase_09 AC 128 ms
81,468 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 136 ms
81,472 KB
testcase_13 AC 140 ms
81,428 KB
testcase_14 AC 6 ms
9,500 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 1 ms
4,376 KB
testcase_17 AC 76 ms
50,452 KB
testcase_18 AC 67 ms
50,600 KB
testcase_19 AC 70 ms
52,468 KB
testcase_20 AC 74 ms
52,480 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

typedef long long int ll;
typedef pair<ll, ll> pll;

#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

ll S[10000005] = {0};

int main()
{
    ll X, Y;
    cin >> X >> Y;

    for (int i = 0; i * i <= Y; ++i)
    {
        for (int j = 1; j * j <= Y; ++j)
        {
            if (i * i + j * j > Y)
                break;
            S[i * i + j * j]++;
        }
    }

    ll max = 0;
    FOR(i, Y + 1, X)
    {
        max = std::max(S[i], max);
    }
    cout << max * 4 << endl;
    return 0;
}
0