結果

問題 No.800 四平方定理
ユーザー kyo1kyo1
提出日時 2020-06-18 21:46:19
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 438 bytes
コンパイル時間 2,728 ms
コンパイル使用メモリ 205,096 KB
実行使用メモリ 87,400 KB
最終ジャッジ日時 2023-09-16 12:21:59
合計ジャッジ時間 9,691 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
12,104 KB
testcase_01 AC 30 ms
6,240 KB
testcase_02 AC 20 ms
5,464 KB
testcase_03 AC 23 ms
5,832 KB
testcase_04 AC 20 ms
5,324 KB
testcase_05 AC 23 ms
5,680 KB
testcase_06 AC 37 ms
6,848 KB
testcase_07 AC 27 ms
6,192 KB
testcase_08 AC 36 ms
7,132 KB
testcase_09 AC 32 ms
6,384 KB
testcase_10 TLE -
testcase_11 TLE -
testcase_12 TLE -
testcase_13 TLE -
testcase_14 TLE -
testcase_15 TLE -
testcase_16 TLE -
testcase_17 TLE -
testcase_18 TLE -
testcase_19 TLE -
testcase_20 AC 1 ms
4,376 KB
testcase_21 AC 1 ms
4,380 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>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N, D;
  cin >> N >> D;
  map<int, int> mp;
  for (int x = 1; x < N + 1; x++) {
    for (int y = 1; y < N + 1; y++) {
      mp[x * x + y * y]++;
    }
  }
  int res = 0;
  for (int z = 1; z < N + 1; z++) {
    for (int w = 1; w < N + 1; w++) {
      res += mp[D + w * w - z * z];
    }
  }
  cout << res << '\n';
  return 0;
}
0