結果
問題 | No.64 XORフィボナッチ数列 |
ユーザー |
![]() |
提出日時 | 2018-06-01 11:15:57 |
言語 | Nim (2.2.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 753 bytes |
コンパイル時間 | 4,068 ms |
コンパイル使用メモリ | 66,816 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-30 08:47:42 |
合計ジャッジ時間 | 4,672 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 11 |
ソースコード
import strutils, sequtils, mathproc tBin(i: int): string =var bf = ivar w = ""while bf != 0:w = int(bf mod 2 != 0).repr & wbf = bf div 2result = wproc xOR0(x0: string, y0: string): string =var x, y: stringy = align(y0, max(x0.len, y0.len), '0')x = align(x0, max(x0.len, y0.len), '0')result = ""for i in 0 ..< x.len:if ($x[i]).parseInt + ($y[i]).parseInt == 1:result.add('1')else:result.add('0')proc rpr(s: string): int =for i, v in s:if $v == $1:result += 2 ^ (s.high - i)let ris = stdin.readLine.split.map(parseInt)let (f0, f1, n) = (ris[0], ris[1], ris[2])let f2 = xOR0(f0.tBin, f1.tBin).rprcase n mod 3:of 0: echo f0of 1: echo f1of 2: echo f2else: discard