結果
問題 | No.51 やる気の問題 |
ユーザー |
![]() |
提出日時 | 2024-10-10 21:55:50 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 25 ms / 5,000 ms |
コード長 | 2,409 bytes |
コンパイル時間 | 892 ms |
コンパイル使用メモリ | 109,076 KB |
実行使用メモリ | 17,920 KB |
最終ジャッジ日時 | 2024-10-10 21:55:53 |
合計ジャッジ時間 | 2,315 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 |
コンパイルメッセージ
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;class Program{static string InputPattern = "InputX";static List<string> GetInputList(){var WillReturn = new List<string>();if (InputPattern == "Input1") {WillReturn.Add("30");WillReturn.Add("5");//19//仕事量が30で、締め切りまでの日数は5である。//この時、//1日目のやる気は30/(5の2乗) =1.2 であるため、この日の作業量は1である。//2日目のやる気は29/(4の2乗) =1.8125 であるため、この日も作業量は1である。//3日目のやる気は28/(3の2乗) =3.111.. であるため、この日の作業量は3である。//4日目のやる気は25/(2の2乗) =6.25 であるため、この日の作業量は6である。//5日目のやる気は19/(1の2乗) =19 であるため、この日の作業量は19である。////つまり、最後の日に行った作業量は19である。}else if (InputPattern == "Input2") {WillReturn.Add("100");WillReturn.Add("2");//75//1日目のやる気は 100/(2の2乗) =25であるため、この日の作業量25である。//2日目のやる気は 75/(1の2乗) =75であるため、この日の作業量75である。////最終日に行った作業量は75になる。}else if (InputPattern == "Input3") {WillReturn.Add("100000");WillReturn.Add("1");//100000////作業量100000を一日で終わらせました}else {string wkStr;while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr);}return WillReturn;}static void Main(){List<string> InputList = GetInputList();long W = long.Parse(InputList[0]);long D = long.Parse(InputList[1]);for (; 1 <= D; D--) {long CurrSagyouyou = W / (D * D);W -= CurrSagyouyou;//Console.WriteLine("残り{0}日での作業量={1}", D, CurrSagyouyou);if (W <= 0) {Console.WriteLine(CurrSagyouyou);break;}}}}