Run ID | 作者 | 问题 | 语言 | 测评结果 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
44133 | 王shizhao | 查找特定的值 | C++ | 解答错误 | 0 MS | 248 KB | 382 | 2024-03-29 14:57:41 |
#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; }