結果
| 問題 |
No.412 花火大会
|
| ユーザー |
明智重蔵
|
| 提出日時 | 2016-09-10 12:46:27 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 27 ms / 2,000 ms |
| コード長 | 2,255 bytes |
| コンパイル時間 | 876 ms |
| コンパイル使用メモリ | 107,648 KB |
| 実行使用メモリ | 19,200 KB |
| 最終ジャッジ日時 | 2024-11-16 19:54:25 |
| 合計ジャッジ時間 | 2,362 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 18 |
コンパイルメッセージ
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;
//YukiCoder412 花火大会
//http://yukicoder.me/problems/no/412
class Program
{
static string InputPattern = "InputX";
static List<string> GetInputList()
{
var WillReturn = new List<string>();
if (InputPattern == "Input1") {
WillReturn.Add("2 4 6");
WillReturn.Add("4");
WillReturn.Add("1 3 5 7");
//2
}
else if (InputPattern == "Input2") {
WillReturn.Add("1 1 1");
WillReturn.Add("4");
WillReturn.Add("1 1 1 1");
//5
}
else if (InputPattern == "Input3") {
WillReturn.Add("100 100 100");
WillReturn.Add("1");
WillReturn.Add("10");
//0
}
else if (InputPattern == "Input4") {
WillReturn.Add("15 25 35");
WillReturn.Add("10");
WillReturn.Add("10 20 30 40 50 60 70 80 90 100");
//932
}
else {
string wkStr;
while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr);
}
return WillReturn;
}
static void Main()
{
List<string> InputList = GetInputList();
int[] wkArr = InputList[0].Split(' ').Select(X => int.Parse(X)).ToArray();
//昇順にシートを割り当てるのでソートしておく
Array.Sort(wkArr);
int B = wkArr[0];
int C = wkArr[1];
int D = wkArr[2];
//昇順にシートを割り当てるのでソートしておく
int[] EArr = InputList[2].Split(' ').Select(X => int.Parse(X)).ToArray();
Array.Sort(EArr);
//場合の数[座れる家族数]なDP表
int[] DPArr = new int[4];
DPArr[0] = 1;
foreach (int EachInt in EArr) {
for (int I = 3; 0 <= I; I--) {
int NewInd = I;
if (I == 0 && B <= EachInt) NewInd = 1;
if (I == 1 && C <= EachInt) NewInd = 2;
if (I == 2 && D <= EachInt) NewInd = 3;
//和の法則
DPArr[NewInd] += DPArr[I];
}
}
Console.WriteLine(DPArr[3]);
}
}
明智重蔵