0
0

yukicoder No.57 ミリオンダイス 解説

Posted at

問題文

解説

まず、一つのサイコロを振った目の期待値は$3.5$である(入出力例1にもあるように)。
また、さいころの出る目は独立なので$x$個サイコロを振った時の期待値は$3.5x$となる。
これをそのまま計算すればOK。

#include <bits/stdc++.h>
using namespace std;

int main(){
  double N;cin>>N;
  cout<<fixed<<setprecision(5);
  cout<<N*3.5<<endl;
}
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0