結果
問題 | No.800 四平方定理 |
ユーザー |
![]() |
提出日時 | 2020-06-18 21:48:45 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 448 bytes |
コンパイル時間 | 2,184 ms |
コンパイル使用メモリ | 195,904 KB |
最終ジャッジ日時 | 2025-01-11 05:15:21 |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 TLE * 8 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int N, D; cin >> N >> D; unordered_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; }