1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

競プロ日記#25/05/07

Posted at

アルゴ式

グループ分け (4)

  • 箱もボールも区別があるのでN個のボールそれぞれに対してM通りの箱の選択肢があるのでMM...よりM^N
int main() {
    int N, M;
    cin >> N >> M;
    long long ans = pow(M,N);
    cout << ans << endl;
}

コイントス (5)

  • 数学でよくやったやつ。きちんとコンビネーションを考慮するのを忘れてはいけない。
int main() {
    int N;
    cin >> N;
    cout << fixed << setprecision(10);
    for (int i = 0;i <= N;i++){
        long long cnt = funcCombination(N,i);
        long long all_pattern = pow(2,N); // 全てのパターン数

        long double ans = (long double)cnt / all_pattern;
        cout << ans << endl;
    }
}
1
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
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?