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

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

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

#include <iostream>
using namespace std;


const int N = 1e5+10;


int decompose(int x){
	int count = 0;
	int cnt = x;
	for(int i = 2 ;i*i<=x;i++)
	    while(x%i == 0) count++,x/=i;
	if(x>1) count++;
	return count;
} 
int main() {
     int t;
     cin>>t;
     while(t--){
        int x;
        cin>>x;
        int ans = decompose(x);
        if(ans % 2  == 0){
            cout<<"yukari"<<endl;
        }else{
            cout<<"kou"<<endl;
        }
     }
     return 0;
}
// 64 位输出请用 printf("%lld")
// 跟博弈论没有半毛钱关系

判断质因子是奇数个还是偶数个

全部评论

相关推荐

不愿透露姓名的神秘牛友
10-29 21:14
疯犬丨哈士奇:喜欢你的人会主动表白,对你有想法的人会很主动,所以要你的公司不会吊着你所以懂了吧
点赞 评论 收藏
分享
__Offer__:认识的室友啥也不回细节,线下面联想大模型一次通关我给我干不回了
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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