結果
| 問題 |
No.112 ややこしい鶴亀算
|
| コンテスト | |
| ユーザー |
明智重蔵
|
| 提出日時 | 2016-02-07 17:09:03 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 32 ms / 5,000 ms |
| コード長 | 1,217 bytes |
| コンパイル時間 | 3,086 ms |
| コンパイル使用メモリ | 115,316 KB |
| 実行使用メモリ | 19,328 KB |
| 最終ジャッジ日時 | 2024-09-21 21:33:35 |
| 合計ジャッジ時間 | 2,980 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 23 |
コンパイルメッセージ
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 Program
{
static string InputPattern = "InputX";
static List<string> GetInputList()
{
var WillReturn = new List<string>();
if (InputPattern == "Input1") {
WillReturn.Add("2");
WillReturn.Add("2 4");
//1 1
//1番目の動物が亀、2番目の動物が鶴である
}
else if (InputPattern == "Input2") {
WillReturn.Add("3");
WillReturn.Add("4 4 4");
//3 0
//3匹とも鶴である
}
else {
string wkStr;
while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr);
}
return WillReturn;
}
static void Main()
{
List<string> InputList = GetInputList();
int[] AArr = InputList[1].Split(' ').Select(X => int.Parse(X)).ToArray();
int S = AArr.Sum() / (AArr.Length - 1);
int TuruCnt = 0;
int KameCnt = 0;
foreach (int EachInt in AArr) {
if (S - EachInt == 2) TuruCnt++;
else KameCnt++;
}
Console.WriteLine("{0} {1}", TuruCnt, KameCnt);
}
}
明智重蔵