結果
問題 | No.67 よくある棒を切る問題 (1) |
ユーザー | syoken_desuka |
提出日時 | 2015-03-05 01:54:57 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 4,788 bytes |
コンパイル時間 | 3,145 ms |
コンパイル使用メモリ | 105,332 KB |
実行使用メモリ | 47,428 KB |
最終ジャッジ日時 | 2023-09-06 13:26:33 |
合計ジャッジ時間 | 9,330 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | AC | 63 ms
22,516 KB |
testcase_02 | AC | 121 ms
29,444 KB |
testcase_03 | AC | 175 ms
42,016 KB |
testcase_04 | AC | 207 ms
44,340 KB |
testcase_05 | AC | 207 ms
40,508 KB |
testcase_06 | WA | - |
testcase_07 | AC | 211 ms
45,288 KB |
testcase_08 | AC | 211 ms
43,336 KB |
testcase_09 | WA | - |
testcase_10 | AC | 195 ms
41,464 KB |
testcase_11 | AC | 203 ms
41,948 KB |
testcase_12 | WA | - |
testcase_13 | AC | 200 ms
44,248 KB |
testcase_14 | AC | 204 ms
42,728 KB |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | AC | 64 ms
22,620 KB |
testcase_25 | AC | 74 ms
25,064 KB |
testcase_26 | AC | 72 ms
22,812 KB |
testcase_27 | AC | 71 ms
22,824 KB |
testcase_28 | AC | 93 ms
24,160 KB |
testcase_29 | AC | 82 ms
23,832 KB |
testcase_30 | AC | 74 ms
23,100 KB |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
#region ZIPPER using System; using System.Collections.Generic; using System.Collections; using System.Linq; using System.Text; using System.Numerics; using sc = Scanner; class Program { static void Main(string[] args) { Solver solver = new Solver(); solver.Solve(); #if DEBUG System.Console.WriteLine("続行するには何かキーを押してください..."); System.Console.ReadKey(); #endif } } /// <summary> /// Java風のスキャナー,自作(某最速の人を参考) 自分の実装のせいか,バグってるっぽい バグが出たらO(n^3) n=100000 でTLE /// </summary> public static class Scanner { public static string NextString() { string tmp = ""; while (true) { int readData; string data; readData = Console.Read(); if (readData == -1) //EOF { break; } data = char.ConvertFromUtf32(readData); if (data == " " || data == "\n") { break; } tmp += data; } return tmp; } public static int NextInt() { string tmp = ""; while (true) { int readData; string data; readData = Console.Read(); if (readData == -1) //EOF { break; } data = char.ConvertFromUtf32(readData); if (data == " " || data == "\n") { break; } tmp += data; } return int.Parse(tmp); } public static long NextLong() { string tmp = ""; while (true) { int readData; string data; readData = Console.Read(); if (readData == -1) //EOF { break; } data = char.ConvertFromUtf32(readData); if (data == " " || data == "\n") { break; } tmp += data; } return long.Parse(tmp); } public static double NextDouble() { string tmp = ""; while (true) { int readData; string data; readData = Console.Read(); if (readData == -1) //EOF { break; } data = char.ConvertFromUtf32(readData); if (data == " " || data == "\n") { break; } tmp += data; } return double.Parse(tmp); } public static string[] NextStrArray() { return Console.ReadLine().Split(' '); } public static int[] NextIntArray() { string[] s = NextStrArray(); int[] a = new int[s.Length]; for (int i = 0; i < a.Length; i++) { a[i] = int.Parse(s[i]); } return a; } public static long[] NextLongArray() { string[] s = NextStrArray(); long[] a = new long[s.Length]; for (int i = 0; i < a.Length; i++) { a[i] = long.Parse(s[i]); } return a; } public static double[] NextDoubleArray() { string[] s = NextStrArray(); double[] a = new double[s.Length]; for (int i = 0; i < a.Length; i++) { a[i] = double.Parse(s[i]); } return a; } } #endregion ZIPPER public class Solver { #region IGNORE_ME public Solver() { //こんすとらくたん きにしなくてよろしい } #endregion IGNORE_ME #region FIELD #endregion FIELD public void Solve() { int n = sc.NextInt(); long[] l = sc.NextLongArray(); long k = sc.NextLong(); double eps = 1.0/10000000000; double low = 0; double mid = 0; double hi = 2 * 10000 + 1000; // seiyaku ni yoru max yori tyotto over while (hi - low > eps) { mid = (low + hi) / 2; if (canCut(l,mid,k)) { low = mid; } else { hi = mid; } } Console.WriteLine((low+hi)/2); #if DEBUG Console.WriteLine("");//local check #endif } /// <summary> ///ipponnatari s no nagasa de k hon kiretu /// </summary> /// <param name="l"></param> /// <param name="s"></param> /// <returns></returns> bool canCut(long[] l,double s, long k) { long countOfCut = 0; for (int i = 0; i < l.Length; i++) { countOfCut += (long)(l[i]/s); } return countOfCut >= k ? true : false; } }