#![allow(unused_imports)] #![allow(non_snake_case)] use proconio::input; use proconio::marker::*; use std::cmp::*; use std::collections::*; fn main() { let month = 12; let day1 = 9; let day2 = 3; let ans = solve(month, day1, day2); println!("{}", ans) } fn solve(M: usize, D1: usize, D2: usize) -> usize { let mut count = 0; for i in 1..=M { for j in 0..=D2 { if i == 2 && j > 2 { continue; } for k in 0..=D1 { if j == 0 && k == 0 { continue; } else if k > 0 { if j == 3 { if i == 4 && i == 6 && i == 9 && i == 11 { continue; } else { if k == 1 { continue; } } } else if j == 2 { if i == 2 { if k > 8 { continue; } } } } if j + k == i { println!("{} + {} = {}", j, k, i); count += 1; } } } } count }