Created
May 12, 2015 12:43
-
-
Save OmarJH/49c3b473f4a2a3d2dc26 to your computer and use it in GitHub Desktop.
asd
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/5 <1) | |
h = h + p1*p3 + (1 - p3)*(1 - p2); | |
else if ((n/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