fork download
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. #define el '\n'
  6. #define sz(v) ((int)((v).size()))
  7. #define clr(v, d) memset(v, d, sizeof(v))
  8.  
  9. double const EPS = 1e-8, PI = acos(-1);
  10. const int N = 1000 + 9, M = 30 + 7, OO = (int) 1e6 + 1;
  11. const long long MOD = 1e9 + 7, INF = 1e18 + 9;
  12.  
  13. typedef long long ll;
  14. typedef long double lld;
  15.  
  16. void OUTPUT() {
  17. cout << fixed << setprecision(12);
  18. ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
  19. }
  20.  
  21. void INPUT() {
  22. #ifndef ONLINE_JUDGE
  23. freopen("input.txt", "r", stdin);
  24. // freopen("output.txt", "w", stdout);
  25. #endif
  26. }
  27.  
  28. int main() {
  29. INPUT();
  30. OUTPUT();
  31. lld a, b, c, x;
  32. cin >> a >> b >> c >> x;
  33.  
  34. lld ans = c;
  35. lld rg = sqrt((c + b) * (c + b) + a * a);
  36. ans += rg;
  37. lld ratio = x / (lld) 100;
  38. lld gh = ratio * sqrt(a * a + b * b);
  39. ans += gh;
  40. ans += (b + c - (b * ratio));
  41. lld kk = a - (a * ratio);
  42. ans += sqrt(kk * kk + c * c);
  43. cout << ans << el;
  44.  
  45. return 0;
  46. }
  47.  
Success #stdin #stdout 0s 4388KB
stdin
Standard input is empty
stdout
-nan