結果

問題 No.800 四平方定理
ユーザー BantakoBantako
提出日時 2019-03-17 21:29:20
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 483 bytes
コンパイル時間 1,386 ms
コンパイル使用メモリ 167,036 KB
実行使用メモリ 42,448 KB
最終ジャッジ日時 2023-09-22 03:48:53
合計ジャッジ時間 5,386 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,384 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 3 ms
4,424 KB
testcase_08 AC 3 ms
6,012 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 24 ms
23,812 KB
testcase_11 AC 27 ms
23,860 KB
testcase_12 AC 29 ms
25,828 KB
testcase_13 AC 20 ms
19,708 KB
testcase_14 AC 24 ms
21,868 KB
testcase_15 AC 26 ms
25,820 KB
testcase_16 AC 22 ms
21,724 KB
testcase_17 AC 21 ms
21,828 KB
testcase_18 AC 33 ms
29,976 KB
testcase_19 AC 33 ms
29,936 KB
testcase_20 AC 1 ms
4,380 KB
testcase_21 AC 2 ms
4,376 KB
testcase_22 AC 33 ms
29,936 KB
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 AC 2 ms
4,376 KB
testcase_27 AC 2 ms
5,356 KB
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 RE -
testcase_32 RE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:8:1: 警告: ISO C++ では型の無い ‘main’ の宣言を禁止しています [-Wreturn-type]
    8 | main(){
      | ^~~~

ソースコード

diff #

#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;
ll cnt[2001*2001+1000000];
main(){
    ll N,D;
    cin >> N >> D;
    unordered_map<ll,int> mp;
    rep(i,1,N+1)rep(j,1,N+1){
        if(i * i - j * j + D < 1)continue;
        cnt[i * i - j * j + D]++;
    }
    ll ans = 0;
    rep(i,1,N+1)rep(j,1,N+1){
        ans += cnt[i * i + j * j];
    }
    cout << ans << endl;
}
0