結果

問題 No.66 輝け☆全国たこやき杯
ユーザー kuuso1kuuso1
提出日時 2014-11-14 00:30:11
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 79 ms / 5,000 ms
コード長 1,501 bytes
コンパイル時間 3,549 ms
コンパイル使用メモリ 107,668 KB
実行使用メモリ 26,764 KB
最終ジャッジ日時 2023-08-30 03:39:54
合計ジャッジ時間 3,766 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 65 ms
22,776 KB
testcase_01 AC 64 ms
24,648 KB
testcase_02 AC 64 ms
22,812 KB
testcase_03 AC 65 ms
20,696 KB
testcase_04 AC 64 ms
22,656 KB
testcase_05 AC 66 ms
26,764 KB
testcase_06 AC 66 ms
22,848 KB
testcase_07 AC 67 ms
22,752 KB
testcase_08 AC 71 ms
24,728 KB
testcase_09 AC 79 ms
22,596 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(){
		
		// dp[i][k]:i番目の人がk回勝つ確率
		double[][] P=new double[1<<M][];
		for(int i=0;i<(1<<M);i++){
			P[i]=new double[M+1];
			P[i][0]=1.0;
		}
		
		for(int k=0;k<M;k++){
			for(int i=0;i<(1<<M);i++){
				int tF= (i^(1<<k)) &(0xFFFF<<k);
				int tE= tF+(1<<k);
//Console.WriteLine("k={0},i={1},tF={2},tE={3}",k,i,tF,tE);
				for(int t=tF;t<tE;t++){
					P[i][k+1]+=P[i][k]*P[t][k]*calP(i,t);
				}
			}
		}
		
		Console.WriteLine(P[0][M]);
	}
	
	double calP(int i,int j){
		return Str[i]*Str[i]/(Str[i]*Str[i]+Str[j]*Str[j]);
	}
	
	int M;
	double[] Str;
	public Sol(){
		M=ri();
		Str=new double[(1<<M)];
		for(int i=0;i<(1<<M);i++){
			Str[i]=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