結果
| 問題 | No.212 素数サイコロと合成数サイコロ (2) |
| コンテスト | |
| ユーザー |
HAHAHA
|
| 提出日時 | 2015-05-23 12:11:30 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 243 ms / 5,000 ms |
| コード長 | 1,199 bytes |
| コンパイル時間 | 557 ms |
| コンパイル使用メモリ | 73,892 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-06 06:08:02 |
| 合計ジャッジ時間 | 1,278 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 10 |
ソースコード
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<utility>
#include<sstream>
#include<cctype>
#include<cmath>
#include<algorithm>
using namespace std;
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define rev(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define repp(i,n) for(int (i)=1;(i)<=(n);(i)++)
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rev(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define clr(a) memset((a), 0 ,sizeof(a))
typedef pair<int,int> P;
typedef vector<pair<int,string> > pii;
typedef map<string,int> mi;
void iostream_init() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.setf(ios::fixed);
cout.precision(12);
}
double sum;
double cnt;
int a[] = {2,3,5,7,11,13};
int b[] = {4,6,8,9,10,12};
void dfs(int P, int C, double A) {
if(P > 0) {
rep(i, 6) dfs(P-1, C, A * a[i]);
} else if(C > 0) {
rep(i, 6) dfs(P, C-1, A * b[i]);
} else {
sum += A;
cnt += 1;
}
}
int main(){
iostream_init();
int P, C;
cin >> P >> C;
dfs(P, C, 1.0);
cout << sum / cnt << endl;
return 0;
}
HAHAHA