Run ID 作者 问题 语言 测评结果 时间 内存 代码长度 提交时间
38309 yuanhaoxiang 开关灯 C++ 通过 0 MS 260 KB 382 2024-01-26 15:32:58

Tests(1/1):


#include<bits/stdc++.h> using namespace std; int main(){ int p,l; cin>>p>>l; bool ls[5001]; for(int i=1;i<=p;i++){ ls[i]=0; } for(int i=1;i<=p;i+=2){ ls[i]=1; } for(int i=3;i<=l;i++){ for(int j=0;j<=l;j++){ if(j%i==0){ ls[j]=(!ls[j]); } } } cout<<"1"; for(int i=2;i<=l;i++){ if(ls[i]==1){ cout<<","<<i; } } return 0; }


测评信息: