結果

問題 No.2461 一点張り
ユーザー Jeet Joshi
提出日時 2023-09-08 22:15:46
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
RE  
実行時間 -
コード長 491 bytes
コンパイル時間 535 ms
コンパイル使用メモリ 62,808 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-06-26 15:20:00
合計ジャッジ時間 927 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample RE * 1
other RE * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>

int main() {
    double p; // Probability of getting a rare character
    std::cout << "Enter the probability of getting a rare character (0 to 1): ";
    std::cin >> p;

    if (p <= 0 || p >= 1) {
        std::cout << "Invalid probability. Please enter a value between 0 and 1." << std::endl;
        return 1;
    }

    double expectedSpins = 1 / p;
    std::cout << "Expected number of spins until a rare character: " << expectedSpins << std::endl;

    return 0;
}
0