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