IzhanVarsky

Untitled

Mar 30th, 2019
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.44 KB | None | 0 0
  1. #include <fstream>
  2. using namespace std;
  3.  
  4. int main() {
  5.     ifstream cin("lottery.in");
  6.     ofstream cout("lottery.out");
  7.     int n, m;
  8.     double s = 0;
  9.     cin >> n >> m;
  10.     int p, val;
  11.     cin >> p >> val;
  12.     for (int i = 1; i < m; ++i) {
  13.         int curP;
  14.         cin >> curP;
  15.         s += val * 1.0 / (p * curP) * (curP - 1);
  16.         p *= curP;
  17.         cin >> val;
  18.     }
  19.     s += val * 1.0 / p;
  20.     cout << n - s;
  21.     return 0;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment