結果
| 問題 | No.3693 均等に分ける |
| コンテスト | |
| ユーザー |
aketijyuuzou
|
| 提出日時 | 2026-09-09 21:25:09 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
不安定
|
| 実行時間 | 29 ms / 2,000 ms |
| + 42µs | |
| コード長 | 1,750 bytes |
| 記録 | |
| コンパイル時間 | 3,600 ms |
| コンパイル使用メモリ | 107,776 KB |
| 実行使用メモリ | 25,344 KB |
| 最終ジャッジ日時 | 2026-09-09 21:25:37 |
| 合計ジャッジ時間 | 4,641 ms |
|
ジャッジサーバーID (参考情報) |
judge2_1 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 10 |
コンパイルメッセージ
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("7 3");
}
else if (InputPattern == "Input2") {
WillReturn.Add("6 3");
}
else if (InputPattern == "Input3") {
WillReturn.Add("5 5");
}
else {
string wkStr;
while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr);
}
return WillReturn;
}
static long[] GetSplitArr(string pStr)
{
return (pStr == "" ? new string[0] : pStr.Split(' ')).Select(pX => long.Parse(pX)).ToArray();
}
static void Main()
{
List<string> InputList = GetInputList();
long[] wkArr = GetSplitArr(InputList[0]);
long N = wkArr[0];
long K = wkArr[1];
long Div = N / K;
long Mod = N % K;
var AnswerList = new List<long>();
for (long I = 1; I <= K; I++) {
AnswerList.Add(Div);
}
int CurrInd = 0;
for (long I = 1; I <= K; I++) {
if (Mod > 0) {
AnswerList[CurrInd]++;
CurrInd++;
Mod--;
}
}
Console.WriteLine(LongEnumJoin(" ", AnswerList));
}
// セパレータとLong型の列挙を引数として、結合したstringを返す
static string LongEnumJoin(string pSeparater, IEnumerable<long> pEnum)
{
string[] StrArr = Array.ConvertAll(pEnum.ToArray(), pX => pX.ToString());
return string.Join(pSeparater, StrArr);
}
}
aketijyuuzou