Advertisement
Ahmed_Negm

E

May 27th, 2022
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.81 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. #include<iostream>
  3. #include<cmath>
  4. #include<iomanip>
  5. #include<algorithm>
  6. #include<cstdlib>
  7. #include<cstring>
  8. #include<vector>
  9. #include<utility>
  10. using namespace std;
  11.  
  12. #define ll long long
  13. #define nl '\n'
  14. #define sz(x) int(x.size())
  15. #define all(x) x.begin(),x.end()
  16. #define rall(s)  s.rbegin(), s.rend()
  17. #define getline(s) getline(cin>>ws,s)
  18. #define ceill(n, m) (((n) / (m)) + ((n) % (m) ? 1 : 0))
  19. #define pi  3.141592653589793
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26. void solve(){
  27.   double a,b,t; cin>>a>>b>>t;
  28.   double c = sqrt(a*a+b*b);
  29.   cout<<fixed<<setprecision(9);
  30.   if(c<=t) cout<<c<<nl;
  31.   else cout<<a+b<<nl;
  32.  
  33.  
  34.  
  35. }
  36.  
  37. int main(){
  38. ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
  39. freopen("cross.in", "r", stdin);
  40. int t =1;
  41. cin>>t;
  42. while(t--){
  43. solve();
  44. }
  45. return 0;
  46. }  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement