結果

問題 No.800 四平方定理
ユーザー eQeeQe
提出日時 2019-03-18 00:02:44
言語 C++11
(gcc 11.4.0)
結果
RE  
実行時間 -
コード長 926 bytes
コンパイル時間 1,084 ms
コンパイル使用メモリ 142,924 KB
実行使用メモリ 35,020 KB
最終ジャッジ日時 2023-09-22 16:10:26
合計ジャッジ時間 6,712 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,496 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 3 ms
4,720 KB
testcase_07 AC 3 ms
4,400 KB
testcase_08 AC 3 ms
4,748 KB
testcase_09 AC 3 ms
4,600 KB
testcase_10 AC 31 ms
34,132 KB
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 1 ms
4,380 KB
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 AC 2 ms
4,380 KB
testcase_27 AC 1 ms
4,380 KB
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 RE -
testcase_32 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define ft first
#define sc second
#define lb lower_bound
#define ub upper_bound
#define pb(t) push_back(t)
#define pt(num) cout << num << "\n"
#define chmax(a, b) (a<b ? a=b : 0)
#define chmin(a, b) (a>b ? a=b : 0)
#define max(a, b) ((a)>(b) ? (a):(b))
#define min(a, b) ((a)<(b) ? (a):(b))
#define moC(a, s, b) (a)=((a)s(b)+MOD)%MOD
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef map<ll, ll> Map;
static const ll INF=1e18;
static const ll MAX=1e5+7;
static const ll MOD=1e9+7;


ll cnt[4040404];
int main(void) {
    ll N, D;
    cin >> N >> D;
    ll i, j;
    
    for(i=1; i<=N; i++) {
        for(j=1; j<=N; j++) {
            cnt[i*i+j*j]++;
        }
    }
    
    ll ans=0;
    for(i=1; i<=N; i++) {
        for(j=1; j<=N; j++) {
            ll t=i*i+D-j*j;
            if(t<=0) continue;
            
            ans+=cnt[t];
        }
    }
    
    pt(ans);
}
0