結果
問題 | No.800 四平方定理 |
ユーザー |
![]() |
提出日時 | 2020-07-18 10:16:39 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 56 ms / 2,000 ms |
コード長 | 407 bytes |
コンパイル時間 | 1,932 ms |
コンパイル使用メモリ | 193,080 KB |
最終ジャッジ日時 | 2025-01-12 00:12:38 |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 30 |
ソースコード
#include <bits/stdc++.h>using namespace std;int main() {int N, D;cin >> N >> D;vector<int> V(N * N * 2 + D + 1);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";}