Advertisement
Alickon

Untitled

Jul 15th, 2023 (edited)
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.45 KB | None | 0 0
  1. //Bismillahir-Rahmanir-Rahim
  2. #include <bits/stdc++.h>
  3.      
  4. using namespace std;
  5.    
  6. #define flash ios_base::sync_with_stdio(0),cin.tie(0)
  7. #define pb push_back
  8. #define ll long long
  9. #define ld long double
  10. #define dbg(x) cerr << #x << " = " << x << "\n";
  11. #define ff first
  12. #define ss second
  13.    
  14. /*
  15. #pragma GCC target ("avx2")
  16. #pragma GCC optimization ("O3")
  17. #pragma comment (linker, "/stack:200000000")
  18. #pragma GCC optimize("Ofast")
  19. #pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
  20. */
  21.        
  22. const long long INF = 1e9 + 7;
  23. const long long MOD = 1e9 + 7;
  24. const int maxn = 1e5 + 10;
  25.  
  26. ld A, B, R, ans, x1, y;
  27.  
  28. void press_F_() {
  29.     cin >> A >> B >> R;
  30.     for (ld x = 0; x * x <= R * R; x += 0.00001) {
  31.         if (A * x + B * sqrt(R * R - x * x) > ans) {
  32.             x1 = x;
  33.             y = sqrt(R * R - x * x);
  34.             ans = A * x + B * sqrt(R * R - x * x);
  35.         }
  36.     }
  37.     cout << fixed << setprecision(5);
  38.     cout << ans << '\n';
  39.     cout << fixed << setprecision(5);
  40.     cout << x1 << " ";
  41.     cout << fixed << setprecision(5);
  42.     cout << y;
  43. }
  44.  
  45. int main() {
  46.     flash;
  47.     int T = 1;
  48.     // cin >> T;
  49.     for (int i = 1; i <= T; i++) {
  50.         // cout << "Case" << " " << i << ':' << "\n";
  51.         press_F_();
  52.     }
  53.     //Respa gold 2023-2024 InshAllah
  54.     return 0;
  55. }
  56. /*
  57. Maybe not today and tomorrow, but InshAllah one day I will reach expert
  58. */
  59. // g++ -std=c++17 main.cpp
  60. // ./a.out
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement