题解 | #小红和小紫的取素因子游戏#
小红和小紫的取素因子游戏
https://www.nowcoder.com/practice/6146f391a69547c4804fe8d0330f1745
#include "bits/stdc++.h" using namespace std; #define int long long #define endl "\n" #define PII pair<int,int> bool isP(int n) { if (n <= 3 || n == 5)return true; for (int i = 2; i * i <= n; i++) { if (n % i == 0)return false; } return true; } void slu() { int n, cnt = 1; cin >> n; if (n == 1) { cout << "yukari\n"; return; } for (int i = 2; i * i <= n; i++) { if (isP(i)) { while (n % i == 0) { n /= i; cnt++; } } } if (n == 1)cnt--; if (cnt & 1)cout << "kou\n"; else cout << "yukari\n"; } signed main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int T; cin >> T; // T = 1; while (T--)slu(); }