結果

問題 No.66 輝け☆全国たこやき杯
ユーザー hogeover30hogeover30
提出日時 2015-03-08 00:58:15
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 22 ms / 5,000 ms
コード長 678 bytes
コンパイル時間 497 ms
コンパイル使用メモリ 60,376 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-06 20:59:33
合計ジャッジ時間 1,261 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 3 ms
4,380 KB
testcase_08 AC 7 ms
4,380 KB
testcase_09 AC 22 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <cstdio>
using namespace std;
#define pow2(n) (1<<(n))

double p[11][1100], s[1100];
int main()
{
    int m;
    while (cin>>m) {
        for(int i=0;i<pow2(m);++i) {
            cin>>s[i];
            p[0][i]=1;
        }
        for(int n=1;n<=m;++n) {
            fill(p[n], p[n]+pow2(m), 0);
            for(int i=0;i<pow2(m);++i) {
                for(int j=0;j<pow2(m);++j)
                    if (i!=j and pow2(n-1)<=(i^j) and (i^j)<pow2(n))
                        p[n][i]+=p[n-1][j]/(s[i]*s[i]+s[j]*s[j]);
                p[n][i]*=s[i]*s[i]*p[n-1][i];
            }
        }
        printf("%.9f\n", p[m][0]);
    }
}
0