https://atcoder.jp/contests/math-and-algorithm/tasks/math_and_algorithm_bb
奇数だと市松模様を考えれば存在しないことは明らかで、偶数だとパスが簡単に分かりますね。
// Move on Squares 2 #![allow(non_snake_case)] //////////////////// library //////////////////// fn read<T: std::str::FromStr>() -> T { let mut line = String::new(); std::io::stdin().read_line(&mut line).ok(); line.trim().parse().ok().unwrap() } fn YesNo(b: bool) -> String { return if b { "Yes".to_string() } else { "No".to_string() } } //////////////////// process //////////////////// fn f(N: i32) -> bool { N % 2 == 0 } fn main() { let N = read(); println!("{}", YesNo(f(N))) }