結果
問題 | No.212 素数サイコロと合成数サイコロ (2) |
ユーザー |
|
提出日時 | 2016-11-20 21:58:19 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 207 ms / 5,000 ms |
コード長 | 611 bytes |
コンパイル時間 | 1,573 ms |
コンパイル使用メモリ | 167,884 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-27 09:08:31 |
合計ジャッジ時間 | 2,413 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 10 |
ソースコード
#include <bits/stdc++.h> using namespace std; int asai[] = { 2, 3, 5, 7, 11, 13 }; int bsai[] = { 4, 6, 8, 9, 10, 12 }; void dfs( int a, int b, double x, double &sum ){ if( a + b == 0 ) return ( void ) ( sum += x ); if( a - 1 >= 0 ){ for( int i = 0; i < 6; ++i ) dfs( a - 1, b, x * asai[ i ], sum ); return; } else{ for( int i = 0; i < 6; ++i ) dfs( a, b - 1, x * bsai[ i ], sum ); return; } } signed main(){ int a, b; cin >> a >> b; double ans = 0.0; dfs( a, b, 1.0, ans ); cout << fixed << setprecision( 12 ) << ans / pow( 6.0, a + b ) << endl; return 0; }