結果

問題 No.66 輝け☆全国たこやき杯
ユーザー リチウムリチウム
提出日時 2014-11-14 00:27:50
言語 Java19
(openjdk 21)
結果
AC  
実行時間 249 ms / 5,000 ms
コード長 793 bytes
コンパイル時間 3,493 ms
コンパイル使用メモリ 74,664 KB
実行使用メモリ 56,436 KB
最終ジャッジ日時 2023-08-30 03:39:49
合計ジャッジ時間 5,777 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 128 ms
55,680 KB
testcase_01 AC 127 ms
54,184 KB
testcase_02 AC 127 ms
56,148 KB
testcase_03 AC 128 ms
55,836 KB
testcase_04 AC 130 ms
55,692 KB
testcase_05 AC 138 ms
55,548 KB
testcase_06 AC 146 ms
55,968 KB
testcase_07 AC 157 ms
56,068 KB
testcase_08 AC 195 ms
56,004 KB
testcase_09 AC 249 ms
56,436 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
public class ok{ 
	public static int aite(int x,int y,int m){
		int a=x/(int)Math.pow(2,y-1);
		if(a%2==0)return a*(int)Math.pow(2,y-1)+(int)Math.pow(2,y-1);
		else return a*(int)Math.pow(2,y-1)-(int)Math.pow(2,y-1);
	}

public static void main(String args[]){
	Scanner sc=new Scanner(System.in);
	int m=sc.nextInt();
	int n=(int)Math.pow(2,m);
	double s[]=new double[n];
	for(int i=0;i<n;i++){
		s[i]=sc.nextInt();
	}
	double dp[][]=new double[m+1][n];
	for(int i=0;i<n;i++){
		dp[0][i]=1;
	}
	for(int i=1;i<=m;i++){
		for(int j=0;j<n;j++){
			int x=aite(j,i,m);
			for(int k=0;k<(int)Math.pow(2,i-1);k++){
				dp[i][j]+=dp[i-1][j]*(dp[i-1][x+k]*(s[j]*s[j])/((s[j]*s[j])+(s[x+k]*s[x+k])));
			}
		}
	
	
	}
	System.out.println(dp[m][0]);
  }}
0