結果
問題 | No.657 テトラナッチ数列 Easy |
ユーザー |
|
提出日時 | 2019-01-17 20:11:16 |
言語 | Nim (2.2.0) |
結果 |
AC
|
実行時間 | 19 ms / 2,000 ms |
コード長 | 675 bytes |
コンパイル時間 | 3,101 ms |
コンパイル使用メモリ | 69,248 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-01 10:10:21 |
合計ジャッジ時間 | 4,145 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 13 |
コンパイルメッセージ
/home/judge/data/code/Main.nim(1, 8) Warning: imported and not used: 'sequtils' [UnusedImport] /home/judge/data/code/Main.nim(1, 54) Warning: imported and not used: 'strformat' [UnusedImport] /home/judge/data/code/Main.nim(1, 26) Warning: imported and not used: 'algorithm' [UnusedImport] /home/judge/data/code/Main.nim(1, 36) Warning: imported and not used: 'math' [UnusedImport] /home/judge/data/code/Main.nim(1, 41) Warning: imported and not used: 'sugar' [UnusedImport] /home/judge/data/code/Main.nim(1, 47) Warning: imported and not used: 'macros' [UnusedImport]
ソースコード
import sequtils,strutils,algorithm,math,sugar,macros,strformat template get*():string = stdin.readLine().strip() template times*(n:int,body) = (for _ in 0..<n: body) template `max=`*(x,y) = x = max(x,y) template `min=`*(x,y) = x = min(x,y) const t = (proc() : tuple[ts:seq[int],n:int] = var (a,b,c,d) = (0,0,0,1) var n = 0 var ts = @[0,0,0,0,1] while true: (a,b,c,d) = (b,c,d,(a+b+c+d) mod 17) if a == 0 and b == 0 and c == 0 and d == 1 : break n += 1 ts &= d return (ts,n) )() proc getTet(n:int):int = if n < t.ts.len : return t.ts[n] return t.ts[4 + (n-4) mod (t.ts.len - 4)] let q = get().parseInt() q.times: echo get().parseInt().getTet()