1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
// Zadanie: Zmi (Zmiana czasu)
// runda 1
// Marcin Machura <marcin.machura@hotmail.com>

use std::io::{self, Write};
use std::process;

fn timedif(d1: i32, h1: i32, m1: i32, d2: i32, h2: i32, m2: i32) -> i32 {
    let t1 = m1+h1*60+24*60*d1;
    let t2 = m2+h2*60+24*60*d2;
    t2-t1
}

fn main() {
    let mut input = String::new();
    
    
    io::stdin()
        .read_line(&mut input)
        .expect("Failed to read from stdin");
        
    
    let nums: Vec<i32> = input
        .split_whitespace()
        .filter_map(|s| s.parse::<i32>().ok()) 
        .collect();
        
    
    
    let x = nums[0];
    let d = nums[1];
    let h = nums[2];
    let m = nums[3];
    
    
    match x {
        1 => {
            println!("{}", timedif(d, h, m, 24, 23, 59)+1);
        }
        2 => {
            println!("{}", timedif(d, h, m, 25, 23, 59)+1);
        }
        3 => {
            println!("{}", timedif(d, h, m, 26, 23, 59)+1);
        }
        4 => {
            println!("{}", timedif(d, h, m, 27, 23, 59)+1);
        }
        5 => {
            if (d >= 29) && (h >= 2) {
                println!("{}", timedif(d, h, m, 29, 23, 59)+1);
            }
            else
            {
                println!("{}", timedif(d, h, m, 29, 23, 59)+1-60);
            }

        }
        _ => {
            println!("uho od sledzia?");
        }
    }
    

    io::stdout().flush().expect("uho od sledzia");


    process::exit(0);
}