Chef and Prime Divisors Problem code: CHAPD (GCD Problem), divisorschapd
Question:
Given two numbers, n, m, find if all prime factors of m can be n, the output is "Yes", OR "No ".
Text:
3120 75128 167 8Output:YesYesNo
Until the maximum number of public appointments is 1, you can check whether the latter is 1.
# Include <iostream> # include <algorithm> # include <cstdio> # include <cstring> # include <cmath> # include <math. h ># include <queue> # define inf 0x3f3f3fusing namespace std; long gcd (long n, long m) {return m = 0? N: gcd (m, n % m); // you forgot to add return WA several times ..} Int main () {long n, m, linoleic; cin> linoleic; while (linoleic --) {cin> n> m; long k = gcd (n, m); while (k> 1) {m = m/k; k = gcd (n, m);} if (m = 1) cout <"Yes" <endl; else cout <"No" <endl;} return 0 ;}
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.