forked from Vicfred/codeforces-rust
-
Notifications
You must be signed in to change notification settings - Fork 0
/
insomnia_cure_148A.rs
59 lines (40 loc) · 1.09 KB
/
insomnia_cure_148A.rs
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
// https://codeforces.com/problemset/problem/148/A
// implementation, simulation, simple math
use std::io;
fn main() {
let mut k = String::new();
io::stdin()
.read_line(&mut k)
.unwrap();
let k: i64 = k.trim().parse().unwrap();
let mut l = String::new();
io::stdin()
.read_line(&mut l)
.unwrap();
let l: i64 = l.trim().parse().unwrap();
let mut m = String::new();
io::stdin()
.read_line(&mut m)
.unwrap();
let m: i64 = m.trim().parse().unwrap();
let mut n = String::new();
io::stdin()
.read_line(&mut n)
.unwrap();
let n: i64 = n.trim().parse().unwrap();
let mut d = String::new();
io::stdin()
.read_line(&mut d)
.unwrap();
let d: i64 = d.trim().parse().unwrap();
let mut dragons = 0;
for idx in 1..d+1 {
if idx % k == 0
|| idx % l == 0
|| idx % m == 0
|| idx % n == 0 {
dragons += 1;
}
}
println!("{}", dragons);
}