結果
問題 | No.800 四平方定理 |
ユーザー |
![]() |
提出日時 | 2019-03-17 22:06:08 |
言語 | Nim (2.2.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 403 bytes |
コンパイル時間 | 4,546 ms |
コンパイル使用メモリ | 66,260 KB |
実行使用メモリ | 11,548 KB |
最終ジャッジ日時 | 2024-07-01 22:38:58 |
合計ジャッジ時間 | 8,733 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | -- * 3 |
other | AC * 10 TLE * 1 -- * 19 |
ソースコード
import strutils, sequtilsproc main() =letnd = 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] = truevar ans: int64 = 0for x in 1..n:for y in 1..n:for z in 1..n:let w2 = x * x + y * y + z * z - dif w2 >= 0 and w2 <= n * n and sq[w2]:ans += 1echo ansmain()