結果
| 問題 | No.800 四平方定理 |
| コンテスト | |
| ユーザー |
👑 ikd
|
| 提出日時 | 2019-03-17 22:06:08 |
| 言語 | Nim (2.2.10 + ACL) |
| 結果 |
TLE
不安定
|
| 実行時間 | - |
| コード長 | 403 bytes |
| 記録 | |
| コンパイル時間 | 4,237 ms |
| コンパイル使用メモリ | 69,752 KB |
| 実行使用メモリ | 5,888 KB |
| 最終ジャッジ日時 | 2026-08-03 14:27:01 |
| 合計ジャッジ時間 | 8,841 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 3 |
| other | AC * 10 TLE * 1 -- * 19 |
ソースコード
import strutils, sequtils
proc main() =
let
nd = stdin.readLine.strip.split.map(parseInt)
(n, d) = (nd[0], nd[1])
var sq = newSeq[bool](n * n + 1)
for i in 1..n:
sq[i * i] = true
var ans: int64 = 0
for x in 1..n:
for y in 1..n:
for z in 1..n:
let w2 = x * x + y * y + z * z - d
if w2 >= 0 and w2 <= n * n and sq[w2]:
ans += 1
echo ans
main()
ikd