結果

問題 No.800 四平方定理
ユーザー Y17Y17
提出日時 2019-03-17 21:41:36
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 453 bytes
コンパイル時間 1,799 ms
コンパイル使用メモリ 150,268 KB
実行使用メモリ 94,500 KB
最終ジャッジ日時 2023-09-22 04:37:09
合計ジャッジ時間 6,310 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
9,772 KB
testcase_01 AC 31 ms
7,324 KB
testcase_02 AC 20 ms
6,004 KB
testcase_03 AC 24 ms
6,536 KB
testcase_04 AC 20 ms
5,888 KB
testcase_05 AC 23 ms
6,248 KB
testcase_06 AC 37 ms
8,100 KB
testcase_07 AC 28 ms
6,756 KB
testcase_08 AC 37 ms
8,360 KB
testcase_09 AC 32 ms
7,260 KB
testcase_10 TLE -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main(){
    long long n, d;
    cin >> n >> d;

    long long ans = 0;
    map<long long, long long> mp;
    for(long long i = 1;i <= n;i++){
        for(long long j = 1;j <= n;j++){
            mp[i*i+j*j]++;
        }
    }

    for(long long i = 1;i <= n;i++){
        for(long long j = 1;j <= n;j++){
            ans += mp[i*i-j*j+d];
        }
    }

    cout << ans << endl;

    return 0;
}




0