結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
5,696 KB
testcase_01 AC 34 ms
7,216 KB
testcase_02 AC 22 ms
5,912 KB
testcase_03 AC 26 ms
6,484 KB
testcase_04 AC 21 ms
6,060 KB
testcase_05 AC 25 ms
6,288 KB
testcase_06 AC 40 ms
8,004 KB
testcase_07 AC 29 ms
6,828 KB
testcase_08 AC 40 ms
8,236 KB
testcase_09 AC 34 ms
7,280 KB
testcase_10 TLE -
testcase_11 TLE -
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;
typedef long long ll;
int main(){
    ll n,d;cin>>n>>d;
    map<ll,ll> mp,mp2;
    for(ll i=1;i<=n;i++){
        for(ll j=1;j<=n;j++){
            mp[i*i+j*j]++;
        }
    }
    ll ans=0;
    for(ll i=1;i<=n;i++){
        for(ll j=1;j<=n;j++){
            ans+=mp[i*i+d-j*j];
        }
    }
    
    cout<<ans<<endl;
}
0