結果

問題 No.800 四平方定理
ユーザー siro53siro53
提出日時 2019-09-30 02:28:48
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 1,192 bytes
コンパイル時間 1,571 ms
コンパイル使用メモリ 163,544 KB
実行使用メモリ 42,428 KB
最終ジャッジ日時 2024-04-14 07:41:16
合計ジャッジ時間 6,196 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 19 ms
42,256 KB
testcase_01 AC 18 ms
42,136 KB
testcase_02 AC 19 ms
42,272 KB
testcase_03 AC 19 ms
42,244 KB
testcase_04 AC 19 ms
42,140 KB
testcase_05 AC 19 ms
42,252 KB
testcase_06 AC 19 ms
42,204 KB
testcase_07 AC 18 ms
42,340 KB
testcase_08 AC 19 ms
42,188 KB
testcase_09 AC 19 ms
42,428 KB
testcase_10 AC 49 ms
42,144 KB
testcase_11 AC 52 ms
42,204 KB
testcase_12 AC 54 ms
42,136 KB
testcase_13 AC 46 ms
42,368 KB
testcase_14 AC 49 ms
42,268 KB
testcase_15 AC 55 ms
42,276 KB
testcase_16 AC 48 ms
42,248 KB
testcase_17 AC 48 ms
42,132 KB
testcase_18 AC 59 ms
42,256 KB
testcase_19 AC 59 ms
42,276 KB
testcase_20 AC 18 ms
42,336 KB
testcase_21 AC 19 ms
42,304 KB
testcase_22 AC 58 ms
42,140 KB
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 AC 18 ms
42,360 KB
testcase_27 AC 19 ms
42,200 KB
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 RE -
testcase_32 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return 1;
    }
    return 0;
}
typedef long long int ll;

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define endl "\n"
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
const double PI = acos(-1);
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//-------------------------------------

vector<int> hoge(5000001);
vector<int> huga(5000001);

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, d;
    cin >> n >> d;
    for (int i = 1; i <= n; i++)
    {
        for (int j = 1; j <= n; j++)
        {
            hoge[i * i + j * j]++;
            if (i * i - j * j + d >= 1)
            {
                huga[i * i - j * j + d]++;
            }
        }
    }
    ll ans = 0;
    for (int i = 0; i < 5000001; i++)
    {
        ans += (ll)hoge[i] * huga[i];
    }
    cout << ans << endl;
}
0