結果

問題 No.800 四平方定理
ユーザー eQeeQe
提出日時 2019-03-17 23:49:00
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 908 bytes
コンパイル時間 1,147 ms
コンパイル使用メモリ 150,244 KB
実行使用メモリ 97,544 KB
最終ジャッジ日時 2023-09-22 15:43:37
合計ジャッジ時間 24,475 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 12 ms
97,544 KB
testcase_01 AC 24 ms
6,012 KB
testcase_02 AC 16 ms
5,092 KB
testcase_03 AC 19 ms
5,460 KB
testcase_04 AC 16 ms
5,204 KB
testcase_05 AC 20 ms
5,484 KB
testcase_06 AC 29 ms
6,572 KB
testcase_07 AC 29 ms
6,784 KB
testcase_08 AC 39 ms
8,244 KB
testcase_09 AC 24 ms
5,968 KB
testcase_10 AC 1,706 ms
72,396 KB
testcase_11 AC 1,824 ms
79,648 KB
testcase_12 TLE -
testcase_13 AC 1,537 ms
63,444 KB
testcase_14 AC 1,658 ms
74,252 KB
testcase_15 AC 1,924 ms
81,564 KB
testcase_16 AC 1,650 ms
75,316 KB
testcase_17 AC 1,659 ms
71,464 KB
testcase_18 TLE -
testcase_19 TLE -
testcase_20 AC 1 ms
4,380 KB
testcase_21 AC 1 ms
4,376 KB
testcase_22 TLE -
testcase_23 TLE -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
権限があれば一括ダウンロードができます

ソースコード

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;
    Map mp;
    
    for(i=1; i<=N; i++) {
        for(j=1; j<=N; j++) {
            mp[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+=mp[i*i+D-j*j];
        }
    }
    
    pt(ans);
}
0