求助!!!TLE
查看原帖
求助!!!TLE
583593
AC_bee楼主2023/9/29 15:28
#include<bits/stdc++.h>
using namespace std;
int n,h;
bool o[43000002];
int u;
int main(){
	cin>>n;
    o[1]=false;
    for(int i=2;i<=1000001;i++){
        o[i]=true;
    }
	for(int i=2;i<=1000001;i++){
		if(o[i]==true){
			for(int j=i;j<=n/i;j++){
				o[i*j]=false;
			}
		}
	}
    for(int i=0;i<n;i++){
        cin>>u;
        for(int j=1;j<=u-1;j++){
            if(o[n^j]==true) {
                h++;
                cout<<(n^j)<<' ';
            }
        }
        cout<<h<<"\n";
        h=0;
    }
}
2023/9/29 15:28
加载中...