fn main() { let month = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; let mut cnt = 0; for (m, ds) in month.iter().enumerate() { let m = m as i32 + 1; for d in 1 .. *ds { let p = d / 10; let q = d - p * 10; if m == p + q { cnt += 1; } } } println!("{}", cnt); }