結果
| 問題 | No.800 四平方定理 |
| コンテスト | |
| ユーザー |
ldsyb
|
| 提出日時 | 2026-09-12 02:09:15 |
| 言語 | C++23 (gcc 15.3.0 + boost 1.92.0 + ACL) |
| 結果 |
TLE
不安定
|
| 実行時間 | - |
| コード長 | 783 bytes |
| 記録 | |
| コンパイル時間 | 3,993 ms |
| コンパイル使用メモリ | 374,584 KB |
| 実行使用メモリ | 6,528 KB |
| 最終ジャッジ日時 | 2026-09-12 02:09:26 |
| 合計ジャッジ時間 | 10,901 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 3 |
| other | AC * 10 TLE * 1 -- * 19 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using namespace chrono;
#if __has_include(<atcoder/all>)
#include <atcoder/all>
using namespace atcoder;
#endif
int main() {
int64_t n, d;
cin >> n >> d;
int64_t ans = 0;
for (int64_t x = 1; x <= n; x++) {
for (int64_t y = 1; y <= n; y++) {
for (int64_t z = 1; z <= n; z++) {
if (x * x + y * y + z * z - d <= 0) {
continue;
}
int64_t w = round(sqrt(x * x + y * y + z * z - d));
if (n < w) {
break;
}
if (x * x + y * y + z * z == w * w + d) {
ans++;
}
}
}
}
cout << ans << endl;
return 0;
}
ldsyb