Created
May 12, 2015 12:48
-
-
Save OmarJH/a7e1fb39af0758661a8f to your computer and use it in GitHub Desktop.
edited
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <vector> | |
using namespace std; | |
int main() | |
{ | |
double h=0; | |
double p1, p2, p3; | |
int n; | |
cin >> p1; | |
cin >> p2; | |
cin >> p3; | |
cin >> n; | |
if (((n-1)/5) %2 !=0 ) | |
h = p1*(1 - p3) + (p3)*(1 - p2); | |
else | |
h = h + p1*p3 + (1 - p3)*(1 - p2); | |
cout << h << endl; | |
cin >> h; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment