signedmain(){ ios::sync_with_stdio(false), cin.tie(0); int t; cin >> t; while (t--) { int n, m; cin >> n >> m; if (n % m == 0) cout << "YES" << endl; else cout << "NO" << endl; } // system("pause"); return0; }
boolcheck(ll x){ while (x) { ll base = 1; ll cnt = 0; while (x >= base) { base *= k; ++cnt; } base /= k; --cnt; ++mp[cnt]; //通过循环找到当前 x 可以拆解出的最高幂次的 k 的次幂 if (mp[cnt] > 1) return1; x -= base; } return0; }
voidsolve(){ mp.clear(); cin >> n >> k; for (int i = 1; i <= n; ++i) cin >> a[i]; if (k == 1) { cout << "YES" << endl; return; } for (int i = 1; i <= n; ++i) { if (a[i]) { if (check(a[i]) == 1) { cout << "NO" << endl; return; } } } cout << "YES" << endl; }
signedmain(){ ios::sync_with_stdio(false), cin.tie(0); int t; cin >> t; while (t--) { solve(); } // system("pause"); return0; }
#include<bits/stdc++.h> usingnamespacestd; typedeflonglong ll; const ll mod = 998244353; //查过了是素数逆元可以直接用费马小定理
ll n, m;
ll fac(ll x){ //阶乘 ll fc = 1; for (int i = 1; i <= x; ++i) fc = fc * i % mod; return fc; }
ll quick_pow(ll a, ll b){ //快速幂 ll ans = 1, base = a; while (b > 0) { if (b & 1) ans = (ans * base) % mod; base = base * base % mod; b >>= 1; } return ans; }
signedmain(){ ios::sync_with_stdio(false), cin.tie(0); while (cin >> n >> m) { ll ans = 1; //答案 ans = ans * C(m, n - 1) % mod; ans = ans * (n - 2) % mod; ans = ans * quick_pow(2, n - 3) % mod; cout << ans << endl; } // system("pause"); return0; }