結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー kuuso1kuuso1
提出日時 2014-11-17 00:12:58
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 313 ms / 5,000 ms
コード長 1,221 bytes
コンパイル時間 1,043 ms
コンパイル使用メモリ 107,392 KB
実行使用メモリ 45,776 KB
最終ジャッジ日時 2024-04-25 23:09:30
合計ジャッジ時間 9,277 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 285 ms
43,648 KB
testcase_01 AC 27 ms
18,944 KB
testcase_02 AC 130 ms
26,752 KB
testcase_03 AC 228 ms
36,352 KB
testcase_04 AC 287 ms
36,992 KB
testcase_05 AC 288 ms
36,864 KB
testcase_06 AC 287 ms
36,608 KB
testcase_07 AC 302 ms
39,936 KB
testcase_08 AC 300 ms
39,680 KB
testcase_09 AC 302 ms
39,808 KB
testcase_10 AC 267 ms
36,096 KB
testcase_11 AC 276 ms
36,608 KB
testcase_12 AC 253 ms
35,840 KB
testcase_13 AC 277 ms
38,656 KB
testcase_14 AC 286 ms
39,296 KB
testcase_15 AC 258 ms
37,888 KB
testcase_16 AC 286 ms
36,992 KB
testcase_17 AC 288 ms
36,992 KB
testcase_18 AC 288 ms
36,864 KB
testcase_19 AC 313 ms
39,680 KB
testcase_20 AC 299 ms
45,776 KB
testcase_21 AC 298 ms
45,772 KB
testcase_22 AC 261 ms
41,892 KB
testcase_23 AC 272 ms
42,444 KB
testcase_24 AC 29 ms
25,040 KB
testcase_25 AC 38 ms
27,436 KB
testcase_26 AC 34 ms
27,036 KB
testcase_27 AC 35 ms
25,308 KB
testcase_28 AC 74 ms
26,452 KB
testcase_29 AC 54 ms
26,068 KB
testcase_30 AC 38 ms
27,316 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Collections;
using System.Collections.Generic;
 
class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		Array.Sort(L,(x,y)=>x>y?-1:x<y?1:0);
		
		double r=(2e10);
		double l=0.0;
		double c=0.0;
		int times=200;
		long cnt=0;
		for(;times>0;times--){
			c=(l+r)/2;
			cnt=0;
			for(int i=0;i<N;i++)cnt+=(long)(L[i]/c);
			if(cnt<K){
				r=c;
			}else{
				l=c;
			}
		}
		
		
		Console.WriteLine(c);
		
		
		
	}
	int N;
	double[] L;
	double K;
	public Sol(){
		N=ri();
		L=rda();
		K=rd();
	}




	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(){return Console.ReadLine().Split(' ');}
	static int[] ria(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>int.Parse(e));}
	static long[] rla(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>long.Parse(e));}
	static double[] rda(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>double.Parse(e));}
}
0