Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- #define FI first
- #define SE second
- #define EPS 1e-9
- #define ALL(a) a.begin(),a.end()
- #define SZ(a) int((a).size())
- #define MS(s, n) memset(s, n, sizeof(s))
- #define FOR(i,a,b) for (int i = (a); i <= (b); i++)
- #define FORE(i,a,b) for (int i = (a); i >= (b); i--)
- #define FORALL(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
- //__builtin_ffs(x) return 1 + index of least significant 1-bit of x
- //__builtin_clz(x) return number of leading zeros of x
- //__builtin_ctz(x) return number of trailing zeros of x
- using namespace std;
- using ll = long long;
- using ld = double;
- typedef pair<int, int> II;
- typedef pair<int, II> III;
- typedef complex<ld> cd;
- typedef vector<cd> vcd;
- const ll MODBASE = 1000000007LL;
- const int MAXN = 210;
- const int MAXM = 100010;
- const int MAXK = 110;
- const int MAXQ = 200010;
- int t[10], T, a[10];
- bool check(int u) {
- FOR(i,1,4) a[i] = t[i];
- a[5] = u;
- sort(a+1, a+6);
- return a[2] + a[3] + a[4] <= 3 * T;
- }
- int main() {
- ios::sync_with_stdio(0);
- cin.tie(nullptr);
- ld x;
- FOR(i,1,4) {
- cin >> x;
- t[i] = int(x * 100);
- }
- cin >> x;
- T = int(x * 100);
- sort(t+1, t+4+1);
- if (t[2] + t[3] + t[4] <= 3 * T) cout << "infinite";
- else if (t[1] + t[2] + t[3] > 3 * T) cout << "impossible";
- else {
- int res = -1;
- FOR(i,0,2100)
- if (check(i)) res = i;
- cout << fixed << setprecision(2) << res / 100.0;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement