結果
| 問題 | No.211 素数サイコロと合成数サイコロ (1) |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-02-08 17:55:04 |
| 言語 | Rust (1.93.0 + proconio + num + itertools) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 1,000 ms |
| コード長 | 725 bytes |
| 記録 | |
| コンパイル時間 | 1,531 ms |
| コンパイル使用メモリ | 200,580 KB |
| 実行使用メモリ | 7,844 KB |
| 最終ジャッジ日時 | 2026-02-08 17:55:08 |
| 合計ジャッジ時間 | 4,004 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 33 |
ソースコード
fn main() {
let stdin = std::io::read_to_string(std::io::stdin()).unwrap();
let mut stdin = stdin.split_ascii_whitespace();
let k: u8 = stdin.next().unwrap().parse().unwrap();
use std::io::Write;
std::io::stdout()
.write_all(output(solve(k)).as_bytes())
.unwrap();
}
fn solve(k: u8) -> f64 {
const PRIMES: [u8; 6] = [2, 3, 5, 7, 11, 13];
const NOT_PRIMES: [u8; 6] = [4, 6, 8, 9, 10, 12];
let mut count = 0;
PRIMES.into_iter().for_each(|p| {
NOT_PRIMES.iter().for_each(|&n| {
if n * p == k {
count += 1
}
})
});
count as f64 / 36.0
}
fn output(ans: f64) -> String {
format!("{:>.013}", ans) + "\n"
}