結果
問題 | No.212 素数サイコロと合成数サイコロ (2) |
ユーザー |
![]() |
提出日時 | 2015-05-22 22:28:26 |
言語 | C++11 (gcc 8.5.0) |
結果 |
AC
|
実行時間 | 231 ms / 5,000 ms |
コード長 | 1,078 bytes |
コンパイル時間 | 588 ms |
使用メモリ | 3,720 KB |
最終ジャッジ日時 | 2023-02-08 18:22:16 |
合計ジャッジ時間 | 1,727 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge14 |
テストケース
テストケース表示入力 | 結果 | 実行時間 使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
3,492 KB |
testcase_01 | AC | 1 ms
3,556 KB |
testcase_02 | AC | 1 ms
3,508 KB |
testcase_03 | AC | 1 ms
3,488 KB |
testcase_04 | AC | 8 ms
3,540 KB |
testcase_05 | AC | 231 ms
3,680 KB |
testcase_06 | AC | 40 ms
3,632 KB |
testcase_07 | AC | 40 ms
3,652 KB |
testcase_08 | AC | 1 ms
3,720 KB |
testcase_09 | AC | 1 ms
3,500 KB |
ソースコード
#include<iostream> #include<fstream> #include<sstream> #include<string> #include<cstdio> #include<cstdlib> #include<cstring> #include<ctime> #include<stack> #include<queue> #include<set> #include<map> #include<vector> #include<list> #include<algorithm> #include<utility> #include<complex> #include<functional> using namespace std; #define input_init stringstream ss; string strtoken, token; istringstream is #define input_line getline(cin, strtoken);is.str(strtoken);is.clear(istringstream::goodbit) #define input_token(num) ss.str(""); ss.clear(stringstream::goodbit); getline(is, token, ','); ss << token; ss >> num double t[] = { 2, 3, 5, 7, 11, 13 }; double s[] = { 4, 6, 8, 9, 10, 12 }; int p, c; double e = 0; void func1(double val,int n){ if (n == c){ e += val; return; } for (int i = 0; i < 6; i++){ func1(val*(s[i] / 6.0), n + 1); } } void func2(double val,int n){ if (n == p){ func1(val, 0); return; } for (int i = 0; i < 6; i++){ func2(val*(t[i]/6.0),n+1); } } int main(void){ cin >> p >> c; func2(1, 0); printf("%.10f\n",e); return(0); }