結果
問題 | No.66 輝け☆全国たこやき杯 |
ユーザー | リチウム |
提出日時 | 2014-11-14 00:44:35 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 241 ms / 5,000 ms |
コード長 | 733 bytes |
コンパイル時間 | 3,278 ms |
コンパイル使用メモリ | 74,084 KB |
実行使用メモリ | 56,628 KB |
最終ジャッジ日時 | 2023-08-30 03:40:07 |
合計ジャッジ時間 | 5,610 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 127 ms
55,688 KB |
testcase_01 | AC | 126 ms
56,232 KB |
testcase_02 | AC | 125 ms
55,792 KB |
testcase_03 | AC | 126 ms
55,684 KB |
testcase_04 | AC | 129 ms
55,808 KB |
testcase_05 | AC | 134 ms
55,628 KB |
testcase_06 | AC | 145 ms
56,020 KB |
testcase_07 | AC | 157 ms
55,536 KB |
testcase_08 | AC | 212 ms
56,368 KB |
testcase_09 | AC | 241 ms
56,628 KB |
ソースコード
import java.util.*; public class ok{ public static int aite(int x,int y,int m){ int c=(int)Math.pow(2,y-1); int a=x/c; int b=a*c; if(a%2==0)return b+c; else return b-c; } 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++){ double a=sc.nextInt(); s[i]=a*a; } 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[x+k])); } } } System.out.println(dp[m][0]); }}