結果

問題 No.567 コンプリート
ユーザー snteasntea
提出日時 2017-09-10 14:43:31
言語 Rust
(1.77.0)
結果
AC  
実行時間 451 ms / 2,000 ms
コード長 1,929 bytes
コンパイル時間 1,112 ms
コンパイル使用メモリ 148,508 KB
実行使用メモリ 87,772 KB
最終ジャッジ日時 2023-08-21 06:37:31
合計ジャッジ時間 2,442 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 1 ms
4,380 KB
testcase_15 AC 451 ms
87,772 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
warning: unused macro definition: `parse`
  --> Main.rs:19:14
   |
19 | macro_rules! parse {
   |              ^^^^^
   |
   = note: `#[warn(unused_macros)]` on by default

warning: unused macro definition: `rvec`
  --> Main.rs:44:14
   |
44 | macro_rules! rvec {
   |              ^^^^

warning: unused macro definition: `readlvec`
  --> Main.rs:50:14
   |
50 | macro_rules! readlvec {
   |              ^^^^^^^^

warning: unused macro definition: `debug`
  --> Main.rs:60:14
   |
60 | macro_rules! debug {
   |              ^^^^^

warning: function `printvec` is never used
  --> Main.rs:66:4
   |
66 | fn printvec<T>(v: &Vec<T>) where T: std::fmt::Display {
   |    ^^^^^^^^
   |
   = note: `#[warn(dead_code)]` on by default

warning: 5 warnings emitted

ソースコード

diff #

// use std::ops::{Index, IndexMut};
// use std::cmp::{Ordering, min, max};
// use std::collections::{BinaryHeap, BTreeMap};
// use std::collections::btree_map::Entry::{Occupied, Vacant};
// use std::clone::Clone;

fn getline() -> String{
    let mut res = String::new();
    std::io::stdin().read_line(&mut res).ok();
    res
}

macro_rules! split {
    ($x: expr) => {
        ($x).trim().split(' ').collect()
    }
}

macro_rules! parse {
    ($x: expr) => {
        ($x).parse().unwrap()
    }
}

macro_rules! readl {
    ($t: ty) => {
        {
            let s = getline();
            let iv: Vec<_> = split!(s);
            let mut iter = iv.into_iter();
            iter.next().unwrap().parse::<$t>().unwrap()
        }
    };
    ($( $t: ty),+ ) => {
        {
            let s = getline();
            let iv: Vec<_> = split!(s);
            let mut iter = iv.into_iter();
            ($(iter.next().unwrap().parse::<$t>().unwrap(),)*) 
        }
    };
}

macro_rules! rvec {
    ($x: expr) => {
        ($x).into_iter().map(|x| parse!(x)).collect()
    }
}

macro_rules! readlvec {
    ($t: ty) => {
        {
            let s = getline();
            let iv: Vec<_> = split!(s);
            iv.into_iter().map(|x| x.parse().unwrap()).collect::<Vec<$t>>()
        }
    }
}

macro_rules! debug {
    ($x: expr) => {
        println!("{}: {}", stringify!($x), $x)
    }
}

fn printvec<T>(v: &Vec<T>) where T: std::fmt::Display {
    for (i,e) in v.into_iter().enumerate() {
        if i != 0 {
            print!(" ");
        }
        print!("{}", e);
    }
    println!("");
}

fn main() {
    let n = readl!(usize);
    let mut dp = vec![vec![0_f64; 7]; n+1];
    dp[0][0] = 1.0;
    for i in 0..n {
        for j in 0..6 {
           dp[i+1][j+1] += dp[i][j]*(6.0-j as f64)/6.0;
           dp[i+1][j] += dp[i][j]*(j as f64)/6.0;
        }
        dp[i+1][6] += dp[i][6];
    }
    println!("{}", dp[n][6]);
}

0