結果

問題 No.800 四平方定理
ユーザー eQeeQe
提出日時 2019-03-17 23:51:17
言語 C++11
(gcc 11.4.0)
結果
RE  
実行時間 -
コード長 921 bytes
コンパイル時間 1,281 ms
コンパイル使用メモリ 143,376 KB
実行使用メモリ 34,760 KB
最終ジャッジ日時 2023-09-22 15:50:50
合計ジャッジ時間 7,731 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
34,620 KB
testcase_01 AC 10 ms
34,520 KB
testcase_02 AC 10 ms
34,680 KB
testcase_03 AC 11 ms
34,576 KB
testcase_04 AC 11 ms
34,760 KB
testcase_05 AC 10 ms
34,628 KB
testcase_06 AC 11 ms
34,620 KB
testcase_07 AC 11 ms
34,624 KB
testcase_08 AC 11 ms
34,624 KB
testcase_09 AC 11 ms
34,628 KB
testcase_10 AC 35 ms
34,596 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 10 ms
34,524 KB
testcase_21 AC 9 ms
34,596 KB
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 AC 9 ms
34,580 KB
testcase_27 AC 12 ms
34,736 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;



int main(void) {
    ll N, D;
    cin >> N >> D;
    ll i, j;
    ll cnt[MAX*40]={};
    
    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++) {
            if(i*i+D-j*j<=0) continue;
            
            ans+=cnt[i*i+D-j*j];
        }
    }
    
    pt(ans);
}
0