結果

問題 No.3099 夜の道路は気をつけて運転しなければならない
ユーザー so-heyso-hey
提出日時 2023-05-28 13:03:54
言語 Rust
(1.77.0)
結果
WA  
実行時間 -
コード長 1,320 bytes
コンパイル時間 3,096 ms
コンパイル使用メモリ 140,848 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-27 07:35:29
合計ジャッジ時間 2,931 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
warning: function `input_num` is never used
 --> Main.rs:1:4
  |
1 | fn input_num() -> usize {
  |    ^^^^^^^^^
  |
  = note: `#[warn(dead_code)]` on by default

warning: function `input_chars` is never used
 --> Main.rs:7:4
  |
7 | fn input_chars() -> Vec<char> {
  |    ^^^^^^^^^^^

warning: function `input_vec_nums` is never used
  --> Main.rs:24:4
   |
24 | fn input_vec_nums() -> Vec<usize> {
   |    ^^^^^^^^^^^^^^

warning: 3 warnings emitted

ソースコード

diff #

fn input_num() -> usize {
    let mut line: String = String::new();
    std::io::stdin().read_line(&mut line).unwrap();
    line.trim().parse().unwrap()
}

fn input_chars() -> Vec<char> {
    let mut line: String = String::new();
    std::io::stdin().read_line(&mut line).unwrap();
    line.trim().chars().collect()
}

fn input_nums() -> (usize, f64, f64) {
    let mut line: String = String::new();
    std::io::stdin().read_line(&mut line).unwrap();
    let mut iter = line.split_whitespace();
    (
        iter.next().unwrap().parse().unwrap(),
        iter.next().unwrap().parse().unwrap(),
        iter.next().unwrap().parse().unwrap()
    )
}

fn input_vec_nums() -> Vec<usize> {
    let mut line: String = String::new();
    std::io::stdin().read_line(&mut line).unwrap();
    line.split_whitespace()
        .map(|x| x.parse().unwrap())
        .collect()
}

fn main() {
    let (mut l, s, d) = input_nums();
    let mut t = d / s;
    let mut ans = 0.0;
    while t > 0.0 {
        if t >= 1.0 {
            t -= 1.0;
            l += 1;
            if l % 24 <= 6 || l % 24 >= 19 {
                ans += 1.0;
            }
        } else {
            l += 1;
            if l % 24 <= 6 || l % 24 >= 18 {
                ans += t;
            }
            t = 0.0;
        }
    }
    println!("{}", ans);
}
0