結果

問題 No.781 円周上の格子点の数え上げ
ユーザー coco18000
提出日時 2019-01-11 22:04:45
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 138 ms / 2,000 ms
コード長 675 bytes
コンパイル時間 1,459 ms
コンパイル使用メモリ 166,592 KB
実行使用メモリ 81,580 KB
最終ジャッジ日時 2024-11-30 07:01:53
合計ジャッジ時間 3,118 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

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