Saleh127

Light OJ 1265 / Probability Expected value

Jul 7th, 2022 (edited)
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.05 KB | None | 0 0
  1. /***
  2.  created: 2022-07-08-00.19.17
  3. ***/
  4.  
  5. #include <bits/stdc++.h>
  6. #include <ext/pb_ds/assoc_container.hpp>
  7. #include <ext/pb_ds/tree_policy.hpp>
  8. using namespace std;
  9. using namespace __gnu_pbds;
  10. template<typename U> using ordered_set=tree<U, null_type,less<U>,rb_tree_tag,tree_order_statistics_node_update>;
  11. #define ll long long
  12. #define test int tt; cin>>tt; for(int cs=1;cs<=tt;cs++)
  13. #define get_lost_idiot return 0
  14. #define nl '\n'
  15.  
  16.  
  17. int main()
  18. {
  19.     ios_base::sync_with_stdio(0);
  20.     cin.tie(0);
  21.     cout.tie(0);
  22.  
  23.  
  24.     test
  25.     {
  26.         ll n,m,i,j,t,d;
  27.  
  28.         cin>>t>>d;
  29.  
  30.         cout<<"Case "<<cs<<": ";
  31.  
  32.         if(t==0)
  33.         {
  34.             cout<<1<<nl;
  35.         }
  36.  
  37.         else if(t%2==0)
  38.         {
  39.             double ans=1.00/((t+1.00)*1.00);
  40.  
  41.             cout<<fixed<<setprecision(10)<<ans<<nl;
  42.         }
  43.  
  44.         else cout<<0<<nl;
  45.     }
  46.  
  47.  
  48.     get_lost_idiot;
  49. }
  50.  
  51. /*
  52.  
  53. d1 = (t / t+1)*(t-1 / t)
  54.  
  55. final winning =(t - 1)/(t + 1)*(t - 3)/(t - 1)*(t - 5)/(t - 3) * 5/7 * 3/5 * 1/3
  56.  
  57. finally = 1 / (t+1);
  58.  
  59. */
  60.  
  61.  
  62.  
  63.  
Add Comment
Please, Sign In to add comment