結果
| 問題 | No.800 四平方定理 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-04-08 13:31:44 |
| 言語 | Python3 (3.14.3 + numpy 2.4.2 + scipy 1.17.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 302 bytes |
| 記録 | |
| コンパイル時間 | 402 ms |
| コンパイル使用メモリ | 20,572 KB |
| 実行使用メモリ | 31,524 KB |
| 最終ジャッジ日時 | 2026-03-23 02:06:50 |
| 合計ジャッジ時間 | 92,093 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 TLE * 1 |
| other | AC * 2 TLE * 28 |
ソースコード
import itertools
n, d = map(int, input().split())
count = 0
r = range(1, n + 1)
for x, y, z in itertools.product(r, r, r):
s = x*x + y*y + z*z - d
if (s <= 0):
continue
w = int(s ** 0.5 + 0.5)
if (w <= n and w*w == s):
# print(x,y,z,w)
count += 1
print(count)