fn main() { input! { a: usize, b: usize, c: usize } // 6の倍数でなければ不可 if (a as u128 * b as u128 * c as u128) % 6 != 0 { println!("No"); return; } // 1が2つ以上あれば不可 if a == 1 && b == 1 || a == 1 && c == 1 || b == 1 && c == 1 { println!("No"); return; } let mp_a = prime_factor(a); let mp_b = prime_factor(b); let mp_c = prime_factor(c); let mut ans = false; ans |= is_enable(&mp_a, &mp_b); ans |= is_enable(&mp_b, &mp_c); ans |= is_enable(&mp_c, &mp_a); println!("{}", if ans {"Yes"} else {"No"}); } fn is_enable( mp_x: &HashMap, mp_y: &HashMap, ) -> bool { let mut has_2 = false; let mut has_3 = false; if mp_x.contains_key(&2) { has_2 = true;} if mp_x.contains_key(&3) { has_3 = true;} if mp_y.contains_key(&2) { has_2 = true;} if mp_y.contains_key(&3) { has_3 = true;} has_2 && has_3 // if mp_x.contains_key(&2) && mp_y.contains_key(&3) { return true; } // if mp_y.contains_key(&2) && mp_x.contains_key(&3) { return true; } // false } // 素因数分解 連想配列(順序不同)を返す。 pub fn prime_factor(x: usize) -> HashMap { let mut mp = HashMap::new(); let mut now = x; let mut i = 2; while i * i <= x { while now % i == 0 { *mp.entry(i).or_insert(0) += 1; now /= i; } i += 1; } if now != 1 { *mp.entry(now).or_insert(0) += 1; } mp } // const MOD93: usize = 998244353; // const MOD17: usize = 1000000007; // const INV2: usize = 499122177; // MOD93の剰余世界では、1/2の代わりにこれを掛ける // const INF: usize = 1 << 60; // const D: [(usize, usize); 4] = [(!0, 0), (0, !0), (1, 0), (0, 1)]; // 上左下右 // fn us(x: i32) -> usize { x as usize } // 文字の定義 // const CHAR_SZ: usize = 26; // const UPPER_A_ASCII : usize = 0x41; // const UPPER_Z_ASCII : usize = UPPER_A_ASCII + SZ - 1; // const LOWER_A_ASCII : usize = 0x61; // const LOWER_Z_ASCII : usize = LOWER_A_ASCII + SZ - 1; #[allow(unused)] #[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Clone)] struct Pos { x: usize, y: usize, } #[allow(unused)] enum Direction { UP = 0, LEFT = 1, DOWN = 2, RIGHT = 3, } #[allow(unused)] #[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Clone)] struct LoopCount { ans: usize, // 答え step: usize, // 残りステップ pos: usize, // 現在位置 cycle_len: usize, // サイクル数 cycle_add: usize, // サイクルによる増加 } #[allow(unused)] use proconio::{input, marker::Chars, marker::Usize1}; // use proconio::{input, input_interactive, marker::Chars, marker::Usize1}; #[allow(unused)] use std::{ println, print, mem::swap, cmp::min, cmp::max, cmp::Reverse, collections::HashSet, collections::BTreeSet, collections::HashMap, collections::BTreeMap, collections::BinaryHeap, collections::VecDeque, iter::FromIterator, }; #[allow(unused)] use itertools::Itertools; // #[allow(unused)] // use num::{integer::gcd, Signed}; // #[allow(unused)] // use num_integer::Roots;// 通常の平方根 // #[allow(unused)] // use superslice::Ext; // #[allow(unused)] // use rand::Rng; // let mut rng = rand::thread_rng(); // let n = rng.gen_range(1, 1000); // 連想配列のデバッグ #[allow(unused)] fn dbg_print_mp(mp: &HashMap) { for (&k, &v) in mp { println!("key:{} val:{}", k, v); } } // グリッドのデバッグ #[allow(unused)] fn dbg_print_grid(h: usize, w: usize, grid: &Vec>) { for i in 0..h { for j in 0..w { print!("{}", grid[i][j]); } println!(); } } // 最短距離のデバッグ #[allow(unused)] fn dbg_print_dist(h: usize, w: usize, dist: &Vec>) { let limit = 255; for i in 0..h { for j in 0..w { print!("{:03} ", min(dist[i][j], limit)); } println!(); } }