Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- using namespace std;
- int main(){
- int n;
- cin>>n;
- vector <double> dp(n+1);
- for (int i=1; i<=n; i++){
- for (int j=1; j<=6; j++){
- if ((1/12.0*((j+6)*(7-j))+1/6.0*(j-1)*dp[i-1])>dp[i]){
- dp[i]=1/12.0*((j+6)*(7-j))+1/6.0*(j-1)*dp[i-1];
- }
- }
- }
- cout<<dp[n]<<endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement