結果

問題 No.456 Millions of Submits!
ユーザー kuuso1kuuso1
提出日時 2016-12-08 21:53:32
言語 C#(csc)
(csc 3.9.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 2,101 bytes
コンパイル時間 2,517 ms
コンパイル使用メモリ 108,640 KB
実行使用メモリ 95,844 KB
最終ジャッジ日時 2023-09-05 20:56:52
合計ジャッジ時間 11,752 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 91 ms
25,868 KB
testcase_01 AC 91 ms
26,008 KB
testcase_02 AC 91 ms
22,088 KB
testcase_03 AC 90 ms
23,824 KB
testcase_04 AC 92 ms
25,812 KB
testcase_05 AC 92 ms
25,892 KB
testcase_06 AC 93 ms
21,992 KB
testcase_07 AC 99 ms
27,264 KB
testcase_08 AC 99 ms
24,188 KB
testcase_09 AC 142 ms
29,716 KB
testcase_10 AC 142 ms
26,596 KB
testcase_11 AC 560 ms
43,348 KB
testcase_12 TLE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		String[] Ans = new String[M];
		Parallel.For(0,M,i=>{
		//for(int i=0;i<M;i++){
			double a = A[i];
			double b = B[i];
			double t = T[i];
			
			Func<double,double> f = x => a * Math.Log(x) + b * Math.Log(Math.Log(x)) - Math.Log(t);
			Func<double,double> df = x => a / x + b / x / Math.Log(x);
			
			double xx = 1 + 1e-12;
			if(B[i] == 0){
				xx = Math.Pow(t,1.0/a);
			}else if(A[i] == 0){
				xx = Math.Exp(Math.Pow(t,1.0/b));
			
			}else{
				for(int j=0;j<20;j++){
					var yy = xx - (a * Math.Log(xx) + b * Math.Log(Math.Log(xx)) - Math.Log(t)) / ( a / xx + b / xx / Math.Log(xx));
					if(yy - xx < 1e-12)break;
					xx = yy;
				}
			}
			//Console.WriteLine("{0},{1},{2},{3},{4}",a,b,t,xx,f(xx)+t);
			Ans[i] = String.Format("{0:F11}",xx);
		//}
		});
		
		Console.WriteLine(String.Join("\n",Ans));
		
		
	}
	int M;
	int[] A,B;
	double[] T;
	public Sol(){
		M = ri();
		A = new int[M];
		B = new int[M];
		T = new double[M];
		for(int i=0;i<M;i++){
			var d = rsa();
			A[i] = int.Parse(d[0]);
			B[i] = int.Parse(d[1]);
			T[i] = double.Parse(d[2]);
		}
	}
	
	static double Newton(double x, Func<double,double> f, Func<double,double> df) {
		// f(x)=0 => ret x-f(x)/df(x);
		return x - f(x)/df(x);
	}

	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(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}
0