結果
| 問題 |
No.45 回転寿司
|
| ユーザー |
outoforder
|
| 提出日時 | 2017-07-23 13:18:20 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 44 ms / 5,000 ms |
| コード長 | 750 bytes |
| コンパイル時間 | 4,775 ms |
| コンパイル使用メモリ | 104,064 KB |
| 実行使用メモリ | 19,584 KB |
| 最終ジャッジ日時 | 2024-12-27 16:46:02 |
| 合計ジャッジ時間 | 4,050 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 30 |
コンパイルメッセージ
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;
using System.Text;
using System.Collections;
namespace procon
{
public class Program
{
public static void Main(string[] args)
{
var n = int.Parse(Console.ReadLine());
var inputs = Console.ReadLine().Split().Select(int.Parse).ToArray();
var tmp = 0;
var take_sum = 0;
var not_sum = 0;
for (int i = 0; i < n; i++)
{
tmp = not_sum + inputs[i];
not_sum = take_sum > not_sum ? take_sum : not_sum;
take_sum = tmp;
}
Console.WriteLine(take_sum > not_sum ? take_sum : not_sum);
}
}
}
outoforder