fork download
  1. /*
  2. ye mera template hai
  3. apna khud likho bc :P
  4. */
  5.  
  6. /*
  7. Author : Sarvagya Agarwal
  8. */
  9.  
  10. #include<bits/stdc++.h>
  11. using namespace std;
  12.  
  13. //defines
  14. #define openin freopen("input.txt","r",stdin)
  15. #define openout freopen("output.txt","w",stdout)
  16. #define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
  17. #define ll long long
  18. #define mod 1000000007
  19. #define rep(i,a,n) for(__typeof(n) i=a;i<=n;++i)
  20. #define all(c) (c).begin(),(c).end()
  21. #define ff first
  22. #define ss second
  23. #define pb push_back
  24. #define mp make_pair
  25.  
  26. //templates
  27. template <typename T>T expo(T e, T n){T x=1,p=e;while(n){if(n&1)x=x*p;p=p*p;n>>=1;}return x;}
  28. template <typename T>T power(T e, T n, T m){T x=1,p=e;while(n){if(n&1)x=(x*p)%m;p=(p*p)%m;n>>=1;}return x;}
  29. template <typename T> T InverseEuler(T a, T m){return (a==1? 1 : power(a, m-2, m));}
  30. template <typename T> T gcd(T a, T b){while(a%=b^=a^=b^=a); return b;}
  31. template <typename T> T lcm(T a, T b){return (a*(b/gcd(a,b)));}
  32.  
  33. double tick()
  34. {
  35. static clock_t oldtick;
  36. clock_t newtick = clock();
  37. double diff = 1.0*(newtick-oldtick)/CLOCKS_PER_SEC;
  38. oldtick = newtick ;
  39. return diff ;
  40. }
  41.  
  42. //debug
  43. #define TRACE
  44.  
  45. #ifdef TRACE
  46. #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
  47. template <typename Arg1>
  48. void __f(const char* name, Arg1&& arg1){
  49. cerr << name << " : " << arg1 << std::endl;
  50. }
  51. template <typename Arg1, typename... Args>
  52. void __f(const char* names, Arg1&& arg1, Args&&... args){
  53. const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
  54. }
  55. #else
  56. #define trace(...)
  57. #endif
  58.  
  59. // DOBARA OVERFLOW KI GALTI HUI TO TU CHUTIYA HAI BC
  60.  
  61. int main()
  62. {
  63. fast;
  64. int t;
  65. cin>>t;
  66. long double n,d;
  67. int p,q,r,s;
  68. while(t--)
  69. {
  70. cin>>p>>q>>r>>s;
  71. n = p*s;
  72. d = q*r + p*s - p*r;
  73. //trace(n,d);
  74. cout<<fixed<<setprecision(10)<<n/d<<endl;
  75. }
  76. return 0;
  77. }
  78.  
Success #stdin #stdout 0s 3408KB
stdin
2
1 3 1 3
1 2 1 2
stdout
0.6000000000
0.6666666667