Advertisement
Guest User

Untitled

a guest
Sep 21st, 2014
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. #include <iomanip>
  4. #include <cstdio>
  5. #include <algorithm>
  6. #include <vector>
  7. #include <string>
  8. #include <cstring>
  9. #include <set>
  10. #include <map>
  11. #include <ctime>
  12. #include <cstdlib>
  13.  
  14. using namespace std;
  15.  
  16. const int N = 210000;
  17.  
  18. int i;
  19. double x, y, z, a, b, c, d;
  20.  
  21. int main()
  22. {
  23. freopen("input.txt","r",stdin);
  24. freopen("output.txt","w",stdout);
  25. cin >> a >> b >> c >> d;
  26. for (i = 1; i < 10000001; i ++)
  27. {
  28. {
  29. x = i / a;
  30. y = i / b;
  31. z = i / c;
  32. if (x + y + z + d == i)
  33. return cout << i, 0;
  34. }
  35. }
  36. cout << - 1;
  37. return 0;
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement