結果

問題 No.45 回転寿司
ユーザー nakamura0422
提出日時 2023-01-10 15:17:04
言語 C#
(.NET 8.0.404)
結果
WA  
実行時間 -
コード長 723 bytes
コンパイル時間 11,207 ms
コンパイル使用メモリ 169,528 KB
実行使用メモリ 186,808 KB
最終ジャッジ日時 2024-12-21 12:14:01
合計ジャッジ時間 11,196 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 2
other AC * 2 WA * 28
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (114 ms)。
MSBuild のバージョン 17.9.6+a4ecab324 (.NET)
  main -> /home/judge/data/code/bin/Release/net8.0/main.dll
  main -> /home/judge/data/code/bin/Release/net8.0/publish/

ソースコード

diff #

using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;

static class ConveyorBeltSushi
{
    static void Main()
    {
    	// 何にも使わない
	    int count = int.Parse(Console.ReadLine());
	    
	    var deliciousness = Console.ReadLine().Split(' ').Select(int.Parse);
	    
	    var sumDeliciousness = deliciousness.Chunk(4).Select(x => {
	    	switch(x.Count()) 
	    	{
	    		case 1:
	    		return x.Max();
	    		case 2:
	    		return x.Max();
	    		case 3:
	    		return Math.Max(x[0] + x[2], x[1]);
	    		case 4:
	    		return Math.Max(x[0] + x[2], x[1] + x[3]);
	    		default:
	    		return 0;
	    	}}).Sum();
	    	
	    	Console.WriteLine(sumDeliciousness);
   }
}
0