結果
| 問題 |
No.45 回転寿司
|
| ユーザー |
masakt
|
| 提出日時 | 2017-04-03 02:17:26 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 681 bytes |
| コンパイル時間 | 733 ms |
| コンパイル使用メモリ | 109,024 KB |
| 実行使用メモリ | 31,856 KB |
| 最終ジャッジ日時 | 2024-07-08 00:25:44 |
| 合計ジャッジ時間 | 13,203 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 4 |
| other | TLE * 1 -- * 29 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System;
using System.Collections.Generic;
using System.Linq;
class P
{
static int Search(int i)
{
int res = 0;
if(i >= n)
{
res = 0;
}
else
{
res = Math.Max(Search(i + 2), Search(i + 3)) + V[i];
}
return res;
}
static int n;
static int[] V = new int[1000];
static void Main(string[]_)
{
n = int.Parse(Console.ReadLine());
V = new int[n + 1];
_=Console.ReadLine().Split(' ');
for (int i = 0; i < n; i++)
{
V[i] = int.Parse(_[i]);
}
Console.WriteLine(Math.Max(Search(0),Search(1)));
}
}
masakt