結果

問題 No.954 Result
ユーザー keymoon
提出日時 2021-02-02 03:22:20
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 36 ms / 2,000 ms
コード長 796 bytes
コンパイル時間 944 ms
コンパイル使用メモリ 110,168 KB
実行使用メモリ 19,200 KB
最終ジャッジ日時 2024-06-29 23:36:29
合計ジャッジ時間 3,376 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 7
other AC * 29
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;
public static class P
{
    public static void Main()
    {
        List<long> fibs = new List<long>() { 1, 1 };
        while (fibs.Last() <= 1e17) fibs.Add(fibs[fibs.Count - 2] + fibs[fibs.Count - 1]);
        var a = Enumerable.Repeat(0, 5).Select(_ => long.Parse(Console.ReadLine())).Reverse().ToArray();
        var seq = fibs.SkipWhile(x => x != a[0]).ToArray();
        if (a[0] == 1 && a[1] != 1) seq = seq.Skip(1).ToArray();
        Console.WriteLine(a.Zip(seq, (x, y) => x == y).TakeWhile(x => x).Count());
    }
}
0