結果

問題 No.45 回転寿司
ユーザー TaK7907
提出日時 2017-11-23 12:14:33
言語 C#(csc)
(csc 3.9.0)
結果
TLE  
実行時間 -
コード長 733 bytes
コンパイル時間 2,507 ms
コンパイル使用メモリ 104,960 KB
実行使用メモリ 36,736 KB
最終ジャッジ日時 2024-11-27 05:23:21
合計ジャッジ時間 173,126 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 3 TLE * 27
権限があれば一括ダウンロードができます
コンパイルメッセージ
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.Generic;
using System.Linq;

namespace yuki0045 {
    class Program {
        static internal List<int> V;
        static internal int FindMax(int k) {
            return V[ k - 1 ] + ( V.Count() - k <= 1 ? 0 : ( V.Count() - k == 2 ) ? V[ k + 1 ] : Math.Max( FindMax( k + 2 ), FindMax( k + 3 ) ) );
        }
        static internal int TakeMax(System.IO.TextReader reader) {
            V = reader.ReadLine().Split().ToList().ConvertAll( int.Parse );
            return V.Count == 1 ? V[ 0 ] : Math.Max( FindMax( 1 ), FindMax( 2 ) );
        }

        static void Main(string[] args) {
            Console.ReadLine();
            Console.WriteLine( TakeMax( Console.In ) );
        }
    }
}
0