結果
| 問題 |
No.212 素数サイコロと合成数サイコロ (2)
|
| コンテスト | |
| ユーザー |
machy
|
| 提出日時 | 2015-06-13 11:14:30 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 11 ms / 5,000 ms |
| コード長 | 1,006 bytes |
| コンパイル時間 | 602 ms |
| コンパイル使用メモリ | 78,048 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-06 16:02:19 |
| 合計ジャッジ時間 | 1,116 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 10 |
ソースコード
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <iomanip>
using namespace std;
typedef long long LL;
int main(){
int v1[] = {2,3,5,7,11,13};
int v2[] = {4,6,8,9,10,12};
int P, C;
cin >> P >> C;
map<LL,LL> prev;
map<LL,LL> next;
prev[1] = 1;
for(int i = 0; i < P; i++){
for(int j = 0; j < 6; j++){
for(auto& p : prev){
next[p.first * v1[j]] += p.second;
}
}
prev.swap(next);
next.clear();
}
for(int i = 0; i < C; i++){
for(int j = 0; j < 6; j++){
for(auto& p : prev){
next[p.first * v2[j]] += p.second;
}
}
prev.swap(next);
next.clear();
}
LL total = 0;
for(auto& p : prev){
total += p.second;
}
double exp = 0.0;
for(auto& p : prev){
exp += p.first * (double)(p.second) / total;
}
cout << setprecision(13) << exp << endl;
return 0;
}
machy