use std::io::{stdin, Read, StdinLock}; use std::str::FromStr; struct Input {} fn read_input(_cin_lock: &mut StdinLock) -> Input { Input {} } fn solve(_input: Input) { let ans = (1..12 + 1) .map(|m| { let max_d = match m { 2 => 28, 4 | 6 | 9 | 11 => 30, _ => 31, }; (1..max_d + 1) .map(|d| { let x_sum = d .to_string() .chars() .into_iter() .map(|s| s.to_string().parse::().ok().unwrap()) .sum::(); if x_sum == m { 1 } else { 0 } }) .sum::() }) .sum::(); println!("{}", ans) } fn _next_token(cin_lock: &mut StdinLock) -> T { cin_lock .by_ref() .bytes() .map(|c| c.unwrap() as char) .skip_while(|c| c.is_whitespace()) .take_while(|c| !c.is_whitespace()) .collect::() .parse::() .ok() .unwrap() } fn main() { let cin = stdin(); let mut cin_lock = cin.lock(); let input = read_input(&mut cin_lock); solve(input); }