結果

問題 No.781 円周上の格子点の数え上げ
ユーザー coco18000coco18000
提出日時 2019-01-11 22:04:45
言語 C++14
(gcc 11.2.0 + boost 1.78.0)
結果
AC  
実行時間 194 ms / 2,000 ms
コード長 675 bytes
コンパイル時間 1,500 ms
使用メモリ 81,644 KB
最終ジャッジ日時 2023-01-06 12:07:43
合計ジャッジ時間 4,067 ms
ジャッジサーバーID
(参考情報)
judge16 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 1 ms
4,900 KB
testcase_01 AC 2 ms
4,900 KB
testcase_02 AC 2 ms
4,904 KB
testcase_03 AC 1 ms
4,904 KB
testcase_04 AC 2 ms
4,904 KB
testcase_05 AC 2 ms
4,900 KB
testcase_06 AC 2 ms
4,900 KB
testcase_07 AC 2 ms
4,904 KB
testcase_08 AC 184 ms
81,484 KB
testcase_09 AC 188 ms
81,548 KB
testcase_10 AC 2 ms
4,904 KB
testcase_11 AC 2 ms
4,904 KB
testcase_12 AC 188 ms
81,600 KB
testcase_13 AC 194 ms
81,644 KB
testcase_14 AC 5 ms
7,952 KB
testcase_15 AC 2 ms
4,904 KB
testcase_16 AC 2 ms
4,904 KB
testcase_17 AC 102 ms
49,756 KB
testcase_18 AC 99 ms
49,664 KB
testcase_19 AC 101 ms
51,056 KB
testcase_20 AC 97 ms
51,060 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