結果

問題 No.800 四平方定理
ユーザー monnumonnu
提出日時 2020-09-29 22:16:57
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 416 bytes
コンパイル時間 1,580 ms
コンパイル使用メモリ 170,584 KB
実行使用メモリ 87,128 KB
最終ジャッジ日時 2023-09-17 20:09:59
合計ジャッジ時間 8,916 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
5,196 KB
testcase_01 AC 30 ms
6,464 KB
testcase_02 AC 20 ms
5,412 KB
testcase_03 AC 23 ms
6,004 KB
testcase_04 AC 19 ms
5,224 KB
testcase_05 AC 23 ms
5,820 KB
testcase_06 AC 37 ms
6,916 KB
testcase_07 AC 27 ms
5,908 KB
testcase_08 AC 35 ms
7,096 KB
testcase_09 AC 31 ms
6,504 KB
testcase_10 TLE -
testcase_11 TLE -
testcase_12 TLE -
testcase_13 TLE -
testcase_14 TLE -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define INF 1000000000000000000
#define MOD 1000000007
using ll=long long;
using Graph=vector<vector<int>>;

int main(){
  int N,D;
  cin>>N>>D;

  map<int,int> m;
  for(int i=1;i<=N;i++){
    for(int j=1;j<=N;j++){
      m[i*i+j*j]++;
    }
  }

  int ans=0;
  for(int i=1;i<=N;i++){
    for(int j=1;j<=N;j++){
      ans+=m[i*i-j*j+D];
    }
  }

  cout<<ans<<endl;

}
0