結果
問題 |
No.800 四平方定理
|
ユーザー |
![]() |
提出日時 | 2020-07-18 10:16:11 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 403 bytes |
コンパイル時間 | 1,851 ms |
コンパイル使用メモリ | 193,720 KB |
最終ジャッジ日時 | 2025-01-12 00:12:23 |
ジャッジサーバーID (参考情報) |
judge2 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 26 RE * 4 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { int N, D; cin >> N >> D; vector<int> V(N * N * 2 + D); for (int x = 1; x <= N; x++) { for (int y = 1; y <= N; y++) V.at(x * x + y * y)++; } int ans = 0; for (int w = 1; w <= N; w++) { for (int z = 1; z <= N; z++) { int tmp = w * w - z * z + D; if (tmp > 0) ans += V.at(tmp); } } cout << ans << "\n"; }