题解 | 小红和小紫的取素因子游戏

小红和小紫的取素因子游戏

https://www.nowcoder.com/practice/6146f391a69547c4804fe8d0330f1745

#include <chrono>
#include <iostream>
using namespace std;
int count(int &x){
    int cnt=0;
    if(x==1)return 0;
    while(x%2==0){
        cnt++;
        x/=2;
    }
    for(int i=3;i*i<=x;i+=2){
        while(x%i==0){
            cnt++;
            x/=i;
        }
    }
    if(x>1)cnt++;
    return cnt;
}
int main(){
    int t;
    cin>>t;
    while(t--){
       int a;
       cin>>a;
       int cnt=count(a);
       if(cnt%2==1)cout<<"kou"<<endl;
       else cout<<"yukari"<<endl;
    }
    return 0;
}
// 64 位输出请用 printf("%lld")   

全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务