結果
問題 | No.800 四平方定理 |
ユーザー |
![]() |
提出日時 | 2020-06-18 21:46:19 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 438 bytes |
コンパイル時間 | 2,022 ms |
コンパイル使用メモリ | 198,216 KB |
最終ジャッジ日時 | 2025-01-11 05:14:17 |
ジャッジサーバーID (参考情報) |
judge3 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 TLE * 1 |
other | AC * 12 TLE * 18 |
ソースコード
#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; }