Advertisement
Guest User

Untitled

a guest
Nov 17th, 2019
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. #define ld long double
  4. #define sf scanf
  5. #define pf printf
  6. #define pb push_back
  7. #define PI ( acos(-1.0) )
  8. #define IN freopen("input.txt","r",stdin)
  9. #define OUT freopen("output.txt","w",stdout)
  10. #define FOR(i,a,b) for(int i=a ; i<=b ; i++)
  11. #define FORD(i,a,b) for(int i=a ; i>=b ; i--)
  12. #define INF 1000000000
  13. #define ll long long int
  14. #define eps (1e-8)
  15. #define sq(x) ( (x)*(x) )
  16. #define all(x) x.begin(),x.end()
  17. #define flog2(n) 64 - __builtin_clzll(n) - 1
  18. #define popcnt(n) __builtin_popcountll(n)
  19.  
  20. using namespace std;
  21.  
  22. typedef pair < int, int > pii;
  23. typedef pair < ll, ll > pll;
  24.  
  25.  
  26.  
  27. int main()
  28. {IN;
  29. ios::sync_with_stdio(0);
  30. cin.tie(NULL);
  31.  
  32. ll a[5];
  33. FOR (i, 1, 4) {
  34. ld x;
  35. cin >> x;
  36. a[i] = round(x * 100);
  37. }
  38.  
  39. ll t;
  40. ld x;
  41. cin >> x;
  42. t = round(x * 100);
  43.  
  44. sort(a + 1, a + 5);
  45. ll res = 3 * t - (a[2] + a[3]);
  46.  
  47. if (a[2] + a[3] + a[4] <= 3 * t) {
  48. cout << "infinite";
  49. }
  50. else if (a[1] + a[2] + a[3] > 3 * t) {
  51. cout << "impossible";
  52. }
  53. else {
  54. cout << fixed << setprecision(2) << res / 100.0 << endl;
  55. }
  56.  
  57. return 0;
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement