use std::io::{stdin, Read, StdinLock}; use std::str::FromStr; use std::iter::FromIterator; fn main() { let cin = stdin(); let mut scan = Scanner::new(cin.lock()); let a = scan.read::(); let b = scan.read::(); let divs = divisors(a); for d in divs { if d % b == 0 { println!("YES"); return; } } println!("NO"); } #[allow(dead_code)] fn divisors(n: i64) -> Vec { let mut ret = vec![]; for i in (1..).take_while(|i| i * i <= n) { if n % i == 0 { ret.push(i); if i != n / i { ret.push(n / i); } } } ret } // region template #[allow(dead_code)] fn iu(i: i64) -> usize { i as usize } #[allow(dead_code)] fn ui(i: usize) -> i64 { i as i64 } #[allow(dead_code, deprecated)] fn join(slice: &[T], sep: &str) -> String { let strings = slice.iter().map(|t| format!("{}", t)).collect::>(); strings.connect(sep) } #[allow(dead_code)] fn arr<'a, S, T>(n: usize, mut f: S) -> Vec where S: FnMut(usize) -> T + 'a { (0..n).map(|i| f(i)).collect::>() } #[allow(dead_code)] fn alt(v: Vec) -> T where T: FromIterator { v.into_iter().collect::() } #[allow(dead_code)] fn dup(v: &[S]) -> T where T: FromIterator, S: Clone { v.iter().cloned().collect::() } struct Scanner<'a> { cin: StdinLock<'a>, } #[allow(dead_code)] impl<'a> Scanner<'a> { fn new(cin: StdinLock<'a>) -> Scanner<'a> { Scanner { cin: cin } } fn read1(&mut self) -> Option { let token = self.cin.by_ref().bytes().map(|c| c.unwrap() as char) .skip_while(|c| c.is_whitespace()) .take_while(|c| !c.is_whitespace()) .collect::(); token.parse::().ok() } fn read(&mut self) -> T { self.read1().unwrap() } fn readn(&mut self, n: usize) -> Vec { (0..n).map(|_| self.read::()).collect() } fn chars(&mut self) -> Vec { self.read::().chars().collect() } } // endregion