complete 2083.rs 2530.rs 2721.rs 4128.rs 5584.rs 7512.rs 21519.rs 21964.rs 22862.rs 22973.rs 24123.rs 26993.rs 27514.rs 33849.rs
This commit is contained in:
32
storage/zeta/rs/completed/2530.rs
Normal file
32
storage/zeta/rs/completed/2530.rs
Normal file
@@ -0,0 +1,32 @@
|
||||
use std::io::{read_to_string, stdin};
|
||||
|
||||
fn main() {
|
||||
let temp = read_to_string(stdin()).unwrap();
|
||||
let mut iter = temp
|
||||
.split_ascii_whitespace()
|
||||
.map(|s| s.parse::<usize>().unwrap());
|
||||
|
||||
let (mut h, mut m, mut s) = (
|
||||
iter.next().unwrap(),
|
||||
iter.next().unwrap(),
|
||||
iter.next().unwrap(),
|
||||
);
|
||||
let cooking_time = iter.next().unwrap();
|
||||
|
||||
for _ in 0..cooking_time {
|
||||
s += 1;
|
||||
if s == 60 {
|
||||
s = 0;
|
||||
m += 1;
|
||||
}
|
||||
if m == 60 {
|
||||
m = 0;
|
||||
h += 1;
|
||||
}
|
||||
if h == 24 {
|
||||
h = 0;
|
||||
}
|
||||
}
|
||||
|
||||
println!("{} {} {}", h, m, s);
|
||||
}
|
||||
Reference in New Issue
Block a user