結果

問題 No.242 ビンゴゲーム
ユーザー Kmcode1Kmcode1
提出日時 2015-07-10 23:04:21
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,621 bytes
コンパイル時間 816 ms
コンパイル使用メモリ 95,584 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-22 10:04:32
合計ジャッジ時間 5,932 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<iostream>
#include<cstdio>
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<cctype>
#include<cstdlib>
#include<algorithm>
#include<bitset>
#include<vector>
#include<list>
#include<deque>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<cmath>
#include<sstream>
#include<fstream>
#include<iomanip>
#include<ctime>
#include<complex>
#include<functional>
#include<climits>
#include<cassert>
#include<iterator>
#include<unordered_map>
using namespace std;
int n;
int t[5];
int y[5];
double ans = 0.0;
/*int __builtin_popcount(int a){
	int r = 0;
	while (a){
		if ((a & 1)){
			r++;
		}
		a >>= 1;
	}
	return r;
}*/
double p9[102];
double H[102];
int main(){
	p9[0] = 1.0;
	H[0] = 1.0;
	scanf("%d", &n);
	double P = (double)(n) / (double)(99.0);
	double PP = 1.0 - P;
	for (int i = 1; i < 102; i++){
		p9[i] = p9[i - 1];
		p9[i] *= P;
		H[i] = H[i - 1];
		H[i] *= PP;
	}
	for (int i = 0; i < 25; i+=5){
		int val = 0;
		for (int j = i; j < i + 5; j++){
			val |= (1 << j);
		}
		t[i/5] = val;
	}
	for (int i = 0; i < 5; i++){
		int val = 0;
		for (int j = i; j < 25; j += 5){
			val |= (1 << j);
		}
		y[i] = val;
	}
	int countt = 0;
	for (int i = 0; i < (1 << 25); i++){
		countt = 0;
		for (int j = 0; j < 5; j++){
			if ((i&t[j]) == t[j]){
				countt++;
			}
			if ((i&y[j]) == y[j]){
				countt++;
			}
		}
		int v = __builtin_popcount(i);
		int ot = 99 - 25;
		if (ot + v < n){
			continue;
		}
		if (v>n){
			continue;
		}
		if (countt == 0){
			continue;
		}
		double pro = p9[v]*p9[n-v]*(double)(countt);
		ans += pro;
	}
	printf("%.6f\n", ans);
	return 0;
}
0