Skip to content

Instantly share code, notes, and snippets.

@OmarJH
Created May 12, 2015 12:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save OmarJH/49c3b473f4a2a3d2dc26 to your computer and use it in GitHub Desktop.
Save OmarJH/49c3b473f4a2a3d2dc26 to your computer and use it in GitHub Desktop.
asd
#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