結果
問題 | No.64 XORフィボナッチ数列 |
ユーザー |
|
提出日時 | 2020-04-29 20:24:38 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 734 bytes |
コンパイル時間 | 1,090 ms |
コンパイル使用メモリ | 109,824 KB |
実行使用メモリ | 50,980 KB |
最終ジャッジ日時 | 2024-11-29 18:05:50 |
合計ジャッジ時間 | 26,545 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 7 TLE * 4 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System;using System.Text;using System.Collections.Generic;using System.Linq;class Program{static void Main(){long[] n = Console.ReadLine().Split().Select(a => long.Parse(a)).ToArray();if(n[2] == 0){Console.WriteLine($"{n[0]}");return;}if(n[2] == 1){Console.WriteLine($"{n[1]}");return;}long before2 = n[0];long before1 = n[1];long current = before2 ^ before1;for(long i = 2; i < n[2]; i++){before2 = before1;before1 = current;current = before2 ^ before1;}Console.WriteLine($"{current}");}}