-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathicpc_mock_TexProblem.cpp
More file actions
70 lines (60 loc) · 2.48 KB
/
icpc_mock_TexProblem.cpp
File metadata and controls
70 lines (60 loc) · 2.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
///////////////// PRANTA KUMER PANDIT ///////////////
// Test Case Less Template ||
// ||
// BANGLADESH UNIVERSITY OF BUSINESS AND TECHNOLOGY ||
// INTAKE 52 ||
// DEPARTMENT OF CSE ||
//||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
// So, WELCOME TO ISHAN'S PARADISE //
// (-.-) Want to be a Secret tool of next ICPC (-.-) //
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define yes cout<<"YES"<<endl
#define no cout<<"NO"<<endl
#define all(x) (x).begin(), (x).end()
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*b)/__gcd(a,b)
#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
void solve() {
long double pkp;
cin >> pkp;
const long double A = 12500.0L;
const long double B = 50000.0L;
const long double C = 150000.0L;
const long double limit = 1e-12L;
auto taxFromIncome = [&](long double I)->long double {
if (I <= A) return 0.0L;
if (I <= B) return (I - A) * 0.20L;
if (I <= 100000.0L) return (B - A) * 0.20L + (I - B) * 0.40L;
if (I <= 125000.0L) return (B - A) * 0.20L + (100000.0L - B) * 0.40L + (I - 100000.0L) * 0.60L;
if (I <= C) return (B - A) * 0.20L + (100000.0L - B) * 0.40L + (125000.0L - 100000.0L) * 0.60L + (I - 125000.0L) * 0.40L;
return (B - A) * 0.20L + (100000.0L - B) * 0.40L + (125000.0L - 100000.0L) * 0.60L + (C - 125000.0L) * 0.40L + (I - C) * 0.45L;
};
long double arkta = 0.0L;
if (pkp <= limit) {
arkta = 0.0L;
} else {
long double lo = 0.0L, hi = 1e18L;
if (pkp <= 47500.0L) hi = 1e6L;
else hi = 1e12L;
for (int iter = 0; iter < 200; ++iter) {
long double mid = (lo + hi) * 0.5L;
long double t = taxFromIncome(mid);
if (t < pkp) lo = mid;
else hi = mid;
}
arkta = (lo + hi) * 0.5L;
}
cout << fixed << setprecision(2) << arkta << "\n";
}
int main() {
optimize();
int lol;
cin >> lol;
while (lol--) {
solve();
}
}
// THANKS //