結果

問題 No.296 n度寝
ユーザー _yoshih_
提出日時 2018-09-30 00:30:48
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 1 ms / 1,000 ms
コード長 715 bytes
コンパイル時間 12,413 ms
コンパイル使用メモリ 379,412 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-12 08:55:42
合計ジャッジ時間 12,959 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

use std::io::*;
use std::str::*;

fn read<T: FromStr>(sl: &mut StdinLock) -> Option<T> {
    let s = sl.by_ref().bytes().map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect::<String>();

    s.parse::<T>().ok()
}

fn run(sl: &mut StdinLock) {
    let n = read::<i32>(sl).unwrap();
    let h = read::<i32>(sl).unwrap();
    let m = read::<i32>(sl).unwrap();
    let t = read::<i32>(sl).unwrap();

    let am = t * (n - 1);
    let ah = (m + am) / 60;

    let h = (h + ah) % 24;
    let m = (m + am) % 60;

    println!("{}", h);
    println!("{}", m);
}

fn main() {
    let s = stdin();
    let mut sl = s.lock();
    run(&mut sl);
}
0