結果
問題 |
No.66 輝け☆全国たこやき杯
|
ユーザー |
|
提出日時 | 2014-11-14 00:27:50 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 266 ms / 5,000 ms |
コード長 | 793 bytes |
コンパイル時間 | 3,825 ms |
コンパイル使用メモリ | 77,384 KB |
実行使用メモリ | 54,956 KB |
最終ジャッジ日時 | 2024-12-31 10:49:20 |
合計ジャッジ時間 | 6,272 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 10 |
ソースコード
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]); }}