結果
| 問題 |
No.2921 Seated in Classroom
|
| コンテスト | |
| ユーザー |
aketijyuuzou
|
| 提出日時 | 2025-02-11 14:20:23 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 959 ms / 2,000 ms |
| コード長 | 1,799 bytes |
| コンパイル時間 | 6,518 ms |
| コンパイル使用メモリ | 117,416 KB |
| 実行使用メモリ | 37,760 KB |
| 最終ジャッジ日時 | 2025-02-11 14:20:36 |
| 合計ジャッジ時間 | 9,275 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 5 |
コンパイルメッセージ
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;
// https://yukicoder.me/problems/no/2921
class Program
{
static string InputPattern = "InputX";
static List<string> GetInputList()
{
var WillReturn = new List<string>();
if (InputPattern == "Input1") {
WillReturn.Add("5");
WillReturn.Add("6 7");
WillReturn.Add("5 14");
WillReturn.Add("18 6");
WillReturn.Add("1 18");
WillReturn.Add("9 17");
}
else if (InputPattern == "Input2") {
WillReturn.Add("6");
WillReturn.Add("7764 52463");
WillReturn.Add("1658 7836");
WillReturn.Add("657456 647734");
WillReturn.Add("64567 734634");
WillReturn.Add("476 857467");
WillReturn.Add("48756587 675761");
}
else {
string wkStr;
while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr);
}
return WillReturn;
}
static void Main()
{
List<string> InputList = GetInputList();
long[] wkArr = { };
Action<string> SplitAct = pStr =>
wkArr = pStr.Split(' ').Select(pX => long.Parse(pX)).ToArray();
foreach (string EachStr in InputList.Skip(1)) {
SplitAct(EachStr);
Solve(wkArr[0], wkArr[1]);
}
}
static void Solve(long pN, long pM)
{
long NeedTukue = pN / 4;
if (pN % 4 > 0) {
NeedTukue++;
}
long RestSeat = NeedTukue * 8 - pN;
pM -= RestSeat;
if (pM > 0) {
NeedTukue += pM / 8;
if (pM % 8 > 0) {
NeedTukue++;
}
}
Console.WriteLine(NeedTukue);
}
}
aketijyuuzou