結果

問題 No.301 サイコロで確率問題 (1)
ユーザー qwewe
提出日時 2025-05-14 13:23:07
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 882 bytes
コンパイル時間 573 ms
コンパイル使用メモリ 73,552 KB
実行使用メモリ 7,840 KB
最終ジャッジ日時 2025-05-14 13:25:10
合計ジャッジ時間 1,060 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <iomanip> // For std::fixed and std::setprecision

// For N >= 7, E_0(N) = (C1_D + C2_D*N) / C3_D
// C1_val = 1022154
// C2_val = 559872
// C3_val = 496951
const double C1_D = 1022154.0;
const double C2_D = 559872.0;
const double C3_D = 496951.0;

int main() {
    // Fast I/O
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(NULL);

    // Set output precision. Sample output for N=7 has 13 decimal places.
    std::cout << std::fixed << std::setprecision(13); 

    int T;
    std::cin >> T;
    while (T--) {
        long long N_ll;
        std::cin >> N_ll;
        if (N_ll <= 6) {
            std::cout << 6.0 << std::endl;
        } else {
            double N_double = static_cast<double>(N_ll);
            double result = (C1_D + C2_D * N_double) / C3_D;
            std::cout << result << std::endl;
        }
    }
    return 0;
}
0