結果

問題 No.800 四平方定理
ユーザー BantakoBantako
提出日時 2019-03-17 21:27:03
言語 C++14
(gcc 11.2.0 + boost 1.78.0)
結果
AC  
実行時間 1,505 ms / 2,000 ms
コード長 454 bytes
コンパイル時間 1,359 ms
使用メモリ 94,876 KB
最終ジャッジ日時 2023-02-11 04:02:42
合計ジャッジ時間 19,326 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 6 ms
4,904 KB
testcase_01 AC 11 ms
5,456 KB
testcase_02 AC 7 ms
4,904 KB
testcase_03 AC 8 ms
6,948 KB
testcase_04 AC 7 ms
6,948 KB
testcase_05 AC 8 ms
4,904 KB
testcase_06 AC 13 ms
5,516 KB
testcase_07 AC 13 ms
5,448 KB
testcase_08 AC 17 ms
6,340 KB
testcase_09 AC 9 ms
4,904 KB
testcase_10 AC 432 ms
48,688 KB
testcase_11 AC 492 ms
52,464 KB
testcase_12 AC 497 ms
54,204 KB
testcase_13 AC 395 ms
44,380 KB
testcase_14 AC 439 ms
50,004 KB
testcase_15 AC 540 ms
53,516 KB
testcase_16 AC 477 ms
50,196 KB
testcase_17 AC 489 ms
48,344 KB
testcase_18 AC 629 ms
59,028 KB
testcase_19 AC 746 ms
82,512 KB
testcase_20 AC 1 ms
4,904 KB
testcase_21 AC 1 ms
4,904 KB
testcase_22 AC 731 ms
56,844 KB
testcase_23 AC 1,405 ms
94,876 KB
testcase_24 AC 1,299 ms
88,808 KB
testcase_25 AC 1,505 ms
93,296 KB
testcase_26 AC 1 ms
6,948 KB
testcase_27 AC 1 ms
4,900 KB
testcase_28 AC 1,308 ms
88,808 KB
testcase_29 AC 1,353 ms
94,428 KB
testcase_30 AC 1,085 ms
86,192 KB
testcase_31 AC 1,053 ms
84,012 KB
testcase_32 AC 1,233 ms
87,292 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:7:1: 警告: ISO C++ では型の無い ‘main’ の宣言を禁止しています [-Wreturn-type]
    7 | 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;
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;
        mp[i * i - j * j + D]++;
    }
    ll ans = 0;
    rep(i,1,N+1)rep(j,1,N+1){
        ans += mp[i * i + j * j];
    }
    cout << ans << endl;
}
0