結果
| 問題 | No.456 Millions of Submits! |
| コンテスト | |
| ユーザー |
kuuso1
|
| 提出日時 | 2016-12-08 00:28:55 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,841 bytes |
| 記録 | |
| コンパイル時間 | 1,965 ms |
| コンパイル使用メモリ | 107,520 KB |
| 実行使用メモリ | 70,528 KB |
| 最終ジャッジ日時 | 2024-06-23 04:53:31 |
| 合計ジャッジ時間 | 9,138 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 1 WA * 11 TLE * 1 |
コンパイルメッセージ
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;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class TEST{
static void Main(){
Sol mySol =new Sol();
mySol.Solve();
}
}
class Sol{
public void Solve(){
double[] Ans = new double[M];
for(int i=0;i<M;i++){
double a = A[i];
double b = B[i];
double t = T[i];
Func<double,double> f = x => Math.Pow(x,a) * Math.Pow(Math.Log(x),b) - t;
Func<double,double> df = x => a * Math.Pow(x,a-1) * Math.Pow(Math.Log(x),b) + b * Math.Pow(x,a-1) * Math.Pow(Math.Log(x),b-1);
if(A[i] == 0) df = x => b * Math.Pow(Math.Log(x),b-1) / x;
if(B[i] == 0) df = x => a * Math.Pow(x,a-1);
double xx = 1.0;
for(int j=0;j<20;j++){
xx = Newton(xx,f,df);
}
Ans[i] = 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));}
}
kuuso1