0分求调
查看原帖
0分求调
1246040
_Star_Universe_楼主2024/7/17 17:13

洛谷最菜的红名居然不会做红题,就很离谱。

以下是代码:

#include<bits/stdc++.h>
using namespace std;

int t,n,k;
int light[1000005];
void press(int x){
    light[x]^=1;
    for(int y=x+x;y<=n;y+=x) press(y);
}

int main(){
	cin>>t;
	while(t--){
		cin>>n>>k;
		for(int i=1;i<=n;i++){
			press(i);
			if(light[i]){
				cout<<"YES"<<endl;
				break;
			}
			else{
				cout<<"NO"<<endl;
				break;
			}
		}
	}
	return 0;
}
2024/7/17 17:13
加载中...