結果

問題 No.211 素数サイコロと合成数サイコロ (1)
ユーザー Mister
提出日時 2020-03-31 20:44:44
言語 C++17(clang)
(17.0.6 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 581 bytes
コンパイル時間 700 ms
コンパイル使用メモリ 124,928 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-30 17:15:30
合計ジャッジ時間 1,804 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <iomanip>
#include <vector>

const std::vector<int>
    d1{2, 3, 5, 7, 11, 13},
    d2{4, 6, 8, 9, 10, 12};

using ldouble = long double;

void solve() {
    int k;
    std::cin >> k;

    int cnt = 0;
    for (auto x1 : d1) {
        for (auto x2 : d2) {
            if (x1 * x2 == k) ++cnt;
        }
    }

    std::cout << std::fixed << std::setprecision(20)
              << ldouble(cnt) / 36 << std::endl;
}

int main() {
    std::cin.tie(nullptr);
    std::cout.tie(nullptr);
    std::ios::sync_with_stdio(false);

    solve();

    return 0;
}
0