結果
| 問題 | No.212 素数サイコロと合成数サイコロ (2) |
| コンテスト | |
| ユーザー |
goodbaton
|
| 提出日時 | 2015-09-21 13:18:42 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 234 ms / 5,000 ms |
| コード長 | 925 bytes |
| コンパイル時間 | 616 ms |
| コンパイル使用メモリ | 71,884 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-19 08:25:41 |
| 合計ジャッジ時間 | 1,398 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 10 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:51:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
51 | scanf("%d%d",&p,&c);
| ~~~~~^~~~~~~~~~~~~~
ソースコード
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <cstring>
typedef long long ll;
using namespace std;
#define mod 1000000007
#define INF 1000000000 //(int)1e9
#define LLINF 2000000000000000000 //(ll)2e18
#define PI 3.1415926536
#define SIZE 100000
int dice1[] = {2,3,5,7,11,13};
int dice2[] = {4,6,8,9,10,12};
int p,c;
ll sum=0;
ll cc = 0;
void dfs(int h,ll calc){
if(h==p+c){
sum += calc;
cc ++;
return;
}
if(h < p){
for(int i=0;i<6;i++){
dfs(h+1,calc*dice1[i]);
}
}else{
for(int i=0;i<6;i++){
dfs(h+1,calc*dice2[i]);
}
}
}
int main(){
scanf("%d%d",&p,&c);
dfs(0,1);
printf("%.15lf",(double)sum/cc);
return 0;
}
goodbaton