結果
問題 | No.800 四平方定理 |
ユーザー |
![]() |
提出日時 | 2020-06-18 21:51:30 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 502 bytes |
コンパイル時間 | 2,717 ms |
コンパイル使用メモリ | 194,360 KB |
最終ジャッジ日時 | 2025-01-11 05:15:40 |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 RE * 8 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int N, D; cin >> N >> D; vector<int> A(6000000, 0); unordered_map<int, int> mp; for (int x = 1; x < N + 1; x++) { for (int y = 1; y < N + 1; y++) { A[x * x + y * y]++; } } int res = 0; for (int z = 1; z < N + 1; z++) { for (int w = 1; w < N + 1; w++) { if (D + w * w - z * z > 0) res += A[D + w * w - z * z]; } } cout << res << '\n'; return 0; }