結果
問題 | No.152 貯金箱の消失 |
ユーザー |
![]() |
提出日時 | 2017-09-18 16:50:08 |
言語 | Nim (2.2.0) |
結果 |
AC
|
実行時間 | 39 ms / 5,000 ms |
コード長 | 579 bytes |
コンパイル時間 | 2,773 ms |
コンパイル使用メモリ | 65,536 KB |
実行使用メモリ | 16,000 KB |
最終ジャッジ日時 | 2024-06-30 03:12:43 |
合計ジャッジ時間 | 3,609 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 12 |
コンパイルメッセージ
/home/judge/data/code/Main.nim(1, 8) Warning: imported and not used: 'sequtils' [UnusedImport] /home/judge/data/code/Main.nim(1, 31) Warning: imported and not used: 'algorithm' [UnusedImport]
ソースコード
import sequtils,strutils,math,algorithmconstm = 1_000_003varL = stdin.readline.parseIntcnt : intitems = newSeq[tuple[x,y,z : int]](0)for a in 1..(floor(sqrt(L / 2)) / 2).int:for b in 0..(floor(sqrt(L / 2)) / 2).int:varx = abs(a * a * 4 - (b * 2 + 1) * (b * 2 + 1))y = 2 * (2 * a) * (2 * b + 1)z = a * a * 4 + (b * 2 + 1) * (b * 2 + 1)if (x + y + z) * 4 <= L and gcd(x,y) == 1:cnt += 1#echo @[x,y,z].join(" ")items.add((x,y,z))cnt = cnt mod mecho cnt