結果
問題 |
No.3295 Buying Bottled Water
|
ユーザー |
![]() |
提出日時 | 2025-10-05 13:51:23 |
言語 | C# (.NET 8.0.404) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,583 bytes |
コンパイル時間 | 16,638 ms |
コンパイル使用メモリ | 168,216 KB |
実行使用メモリ | 187,288 KB |
最終ジャッジ日時 | 2025-10-05 13:52:10 |
合計ジャッジ時間 | 9,993 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 WA * 2 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.csproj を復元しました (114 ミリ秒)。 main -> /home/judge/data/code/bin/Release/net8.0/main.dll main -> /home/judge/data/code/bin/Release/net8.0/publish/
ソースコード
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("700"); //2 } else if (InputPattern == "Input2") { WillReturn.Add("550"); //1 } else if (InputPattern == "Input3") { WillReturn.Add("2300"); //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 long mN; static void Main() { List<string> InputList = GetInputList(); mN = long.Parse(InputList[0]); long L = 0; long R = mN * 500; if (mN < 100) { Console.WriteLine(0); } while (L + 1 < R) { long Mid = R / 2; if (R < long.MaxValue) { Mid = (L + R) / 2; } if (CanAchieve(Mid)) { R = Mid; } else { L = Mid; } } Console.WriteLine(R); } // Xが解かをを返す static bool CanAchieve(long pX) { long Result = mN - 500 * pX; return Result < 100; } }