Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <fstream>
- using namespace std;
- int main() {
- ifstream cin("lottery.in");
- ofstream cout("lottery.out");
- int n, m;
- double s = 0;
- cin >> n >> m;
- int p, val;
- cin >> p >> val;
- for (int i = 1; i < m; ++i) {
- int curP;
- cin >> curP;
- s += val * 1.0 / (p * curP) * (curP - 1);
- p *= curP;
- cin >> val;
- }
- s += val * 1.0 / p;
- cout << n - s;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment