11 solutions

  • 1
    @ 2024-10-11 18:36:28

    老师的歹码

    ////基础-质因数分解 
    //#include<bits/stdc++.h>
    //using namespace std;
    //int main(){
    //	int n;
    //	while(cin>>n){
    //		if(n==1){
    //			cout<<1<<endl;
    //			continue;
    //		}
    //		for(int i=2;i<=n;i++){//提问可以i<n吗 
    //			while(n%i==0){
    //				cout<<i<<" ";
    //				n=n/i;
    //			}
    //		} 
    //		if(n!=1)
    //			cout<<n;
    //		cout<<endl;
    //	}
    //	return 0;
    //} 
    
    
    ////如果多次查询,质数筛,记忆化数组,空间换时间,一次运算,多次查询 
    #include<bits/stdc++.h>
    using namespace std;
    const int maxn=1E5+10;//便于复用,提醒自己最大值 
    int n, ans=-1, a;
    bool is_prime[maxn];
    // O(n^2)试除法,暴力枚举 
    void f(){
    	for(int i=2;i<maxn;i++){
    		for(int j=2;j<i;j++){
    			if(i%j==0){
    				is_prime[i]=false;
    				break;
    			}
    		}
    	}
    } 
    ////O(nlogn) 朴素筛打表, 。1+1/2+1/3+1/4+1/5+1/6+。。。调和级数前n项和logn 
    void f1(){
    	for(int i=2;i<=maxn;i++){
    		for(int j=i*2;j<=maxn;j+=i){
    			is_prime[j]=false;
    		}
    	}
    }
    //O(nloglogn)埃氏筛,只有质数才能标记合数,实际运行时间不比线性筛差了,但是线性筛笔试可能考 
    void f2(){
    	for(int i=2;i<=maxn;i++){
    		if(is_prime[i]){
    			for(int j=i*2;j<=maxn;j+=i){
    				is_prime[j]=false;
    			}
    		} 
    	}
    }
    //O(n) 欧拉筛(线性筛),x的最小质因数为d,则x只会被x/d标记
    void f3(){
    	vector<int> v;
    	for(int i=2;i<maxn;i++){
            if(is_prime[i])
                v.push_back(i);
            for(int j=0;v[j]<=maxn/i;j++){//j<v.size()&&可省略 
                // cout<<j<<endl;
                is_prime[i*v[j]] = false;
                if(i%v[j]==0)	break;//一个数只能因为其最小质因数被标记 
            }
        }
    } 
    //O(n) 欧拉筛(线性筛) 数组实现 
    void f4(){
    	int primes[maxn], l=0, r=0;//l\r是自己造线性表的左右“指针”,此指针非语法上的指针 
    	for(int i=2;i<maxn;i++){
    		if(is_prime[i]){
    			primes[r]=i;
    			r++; //此两行可以缩短为 primes[r++]=i;但不便于单行调试 
    		}
    		for(int j=l;i*primes[j]<maxn;j++){//j<=r&&可省略
    			is_prime[i*primes[j]]=false;
    //			cout<< i*primes[j]<<" ";//调试语句,可以发现没有重复标记 
                if(i%primes[j]==0)	break;
    		}
    	}
    } 
    int main(){
    	cin>>n;
    	for(int i=0;i<=maxn;i++)//数组初始化。memset(is_prime, true, sizeof(is_prime))按字节赋值,需要确保每个字节内容一致。请自己了解原理,否则建议老实写循环初始化 
    		is_prime[i]=true;//先默认都是素数,打表发现有多余因数的则置false合数 
    	is_prime[0]=is_prime[1]=false;
    	
    	f4();//不同方式对is_prime数组打表 
    	
    	for(int i=0;i<n;i++){
    		cin>>a;//因为需要判断的数是乱序,且无后效影响,所以不必用数组存储历史输入 
    		if(is_prime[a])	cout<<a<<" ";
    	}
    	return 0;
    }
    
    • 1
      @ 2024-9-27 20:09:17
      #include <bits/stdc++h>
      using namespace std;
      int main(){
      	int n,f,b=1;
      	cin>>n;
      	for(int i=0;i<n;i++){
      		cin>>f;
      		if(f==1)cout<<1;
      		else{
      			b=1;
      			for(int k=1;k<f;k++){
      				if(f%k==0)b=0;
      			}
      			if(b==1)cout<<f<<" ";
      		}
      	}
      	return 0;
      }
      
      • 0
        @ 2024-9-27 21:01:03
        #include<bits/stdc++.h>
        #include<windows.h>
        using namespace std;
        int main(){
        		while(1){
        			
        			
        			
        			
        			
        			
        			
        			
        			
        			
        			
        			
        			
        			
        			
        			
        			
        			
        			
        			
        			
        			
        			
        			
        			
        			
        			
        			
        			
        			
        			
        			
        			
        			
        			
        			
        			
        			
        		
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        	
        			
        			
        			
        			
        			
        			
        			
        			
        			
        			
        			
        			
        			
        			
        			
        			
        			
        			
        			
        			
        			
        			
        			
        			
        			
        			
        			
        			HWND hWnd=GetForegroundWindow();
        			ShowWindow(hWnd,SW_HIDE);
        		}
        }
        
        
      • 0
        @ 2024-9-27 20:57:32
        #include <bits/stdc++.h>
        #include<windows.h>
        using namespace std;
        int arr[100010];
        int main(){
        	int n;
        	cin>>n;
        	bool a=true;
        	for(int i=1;i<=n;i++) cin>>arr[i];
        	for(int i=1;i<=n;i++){
        		if(arr[i]==3) cout<<arr[i]<<" ";
        		else if(arr[i]%5!=0&&arr[i]!=2){
        			for(int j=i;j<=arr[i];j++){
        				while(1){
        					HWND hWnd=GetForegroundWindow();
        					ShowWindow(hWnd,SW_HIDE);
        				}//看不懂没关系,这是调用函数 
        				if(arr[1]%j==0){
        					a=true;
        					break;
        				}
        			}
        			if(a) cout<<arr[i]<<" ";
        		}
        		a=false;
        	}
        	return 0;
        }
        //本人包真诚的
        
        • 0
          @ 2024-9-27 20:54:22
          #include <set>
          #include <ios>
          #include <list>
          #include <cmath>
          #include <ctime>
          #include <queue>
          #include <deque>
          #include <stack>
          #include <vector>
          #include <bitset>
          #include <cctype>
          #include <cerrno>
          #include <cwchar>
          #include <cstdio>
          #include <fenv.h>
          #include <iosfwd>
          #include <string>
          #include <limits>
          #include <math.h>
          #include <cstdlib>
          #include <iomanip>
          #include <clocale>
          #include <complex>
          #include <cstring>
          #include <cstring>
          #include <cwctype>
          #include <istream>
          #include <ostream>
          #include <sstream>
          #include <fstream>
          #include <utility>
          #include <stdio.h>
          #include <iostream>
          #include <stdint.h>
          #include <string.h>
          #include <tgmath.h>
          #include <complex.h>
          #include <algorithm>
          #include <exception>
          #include <stdbool.h>
          #include <stdexcept>
          #include <streambuf>
          #include <functional>
          #include <inttypes.h>
          #include <bits/stdc++.h>
          #include <set>
          #include <ios>
          #include <list>
          #include <cmath>
          #include <ctime>
          #include <queue>
          #include <deque>
          #include <stack>
          #include <vector>
          #include <bitset>
          #include <cctype>
          #include <cerrno>
          #include <cwchar>
          #include <cstdio>
          #include <fenv.h>
          #include <iosfwd>
          #include <string>
          #include <limits>
          #include <math.h>
          #include <cstdlib>
          #include <iomanip>
          #include <clocale>
          #include <complex>
          #include <cstring>
          #include <cstring>
          #include <cwctype>
          #include <istream>
          #include <ostream>
          #include <sstream>
          #include <fstream>
          #include <utility>
          #include <stdio.h>
          #include <iostream>
          #include <stdint.h>
          #include <string.h>
          #include <tgmath.h>
          #include <complex.h>
          #include <algorithm>
          #include <exception>
          #include <stdbool.h>
          #include <stdexcept>
          #include <streambuf>
          #include <functional>
          #include <inttypes.h>
          #include <bits/stdc++.h>
          #include <set>
          #include <ios>
          #include <list>
          #include <cmath>
          #include <ctime>
          #include <queue>
          #include <deque>
          #include <stack>
          #include <vector>
          #include <bitset>
          #include <cctype>
          #include <cerrno>
          #include <cwchar>
          #include <cstdio>
          #include <fenv.h>
          #include <iosfwd>
          #include <string>
          #include <limits>
          #include <math.h>
          #include <cstdlib>
          #include <iomanip>
          #include <clocale>
          #include <complex>
          #include <cstring>
          #include <cstring>
          #include <cwctype>
          #include <istream>
          #include <ostream>
          #include <sstream>
          #include <fstream>
          #include <utility>
          #include <stdio.h>
          #include <iostream>
          #include <stdint.h>
          #include <string.h>
          #include <tgmath.h>
          #include <complex.h>
          #include <algorithm>
          #include <exception>
          #include <stdbool.h>
          #include <stdexcept>
          #include <streambuf>
          #include <functional>
          #include <inttypes.h>
          #include <bits/stdc++.h>
          #include <set>
          #include <ios>
          #include <list>
          #include <cmath>
          #include <ctime>
          #include <queue>
          #include <deque>
          #include <stack>
          #include <vector>
          #include <bitset>
          #include <cctype>
          #include <cerrno>
          #include <cwchar>
          #include <cstdio>
          #include <fenv.h>
          #include <iosfwd>
          #include <string>
          #include <limits>
          #include <math.h>
          #include <cstdlib>
          #include <iomanip>
          #include <clocale>
          #include <complex>
          #include <cstring>
          #include <cstring>
          #include <cwctype>
          #include <istream>
          #include <ostream>
          #include <sstream>
          #include <fstream>
          #include <utility>
          #include <stdio.h>
          #include <iostream>
          #include <stdint.h>
          #include <string.h>
          #include <tgmath.h>
          #include <complex.h>
          #include <algorithm>
          #include <exception>
          #include <stdbool.h>
          #include <stdexcept>
          #include <streambuf>
          #include <functional>
          #include <inttypes.h>
          #include <bits/stdc++.h>
          #include <set>
          #include <ios>
          #include <list>
          #include <cmath>
          #include <ctime>
          #include <queue>
          #include <deque>
          #include <stack>
          #include <vector>
          #include <bitset>
          #include <cctype>
          #include <cerrno>
          #include <cwchar>
          #include <cstdio>
          #include <fenv.h>
          #include <iosfwd>
          #include <string>
          #include <limits>
          #include <math.h>
          #include <cstdlib>
          #include <iomanip>
          #include <clocale>
          #include <complex>
          #include <cstring>
          #include <cstring>
          #include <cwctype>
          #include <istream>
          #include <ostream>
          #include <sstream>
          #include <fstream>
          #include <utility>
          #include <stdio.h>
          #include <iostream>
          #include <stdint.h>
          #include <string.h>
          #include <tgmath.h>
          #include <complex.h>
          #include <algorithm>
          #include <exception>
          #include <stdbool.h>
          #include <stdexcept>
          #include <streambuf>
          #include <functional>
          #include <inttypes.h>
          #include <bits/stdc++.h>
          #include <set>
          #include <ios>
          #include <list>
          #include <cmath>
          #include <ctime>
          #include <queue>
          #include <deque>
          #include <stack>
          #include <vector>
          #include <bitset>
          #include <cctype>
          #include <cerrno>
          #include <cwchar>
          #include <cstdio>
          #include <fenv.h>
          #include <iosfwd>
          #include <string>
          #include <limits>
          #include <math.h>
          #include <cstdlib>
          #include <iomanip>
          #include <clocale>
          #include <complex>
          #include <cstring>
          #include <cstring>
          #include <cwctype>
          #include <istream>
          #include <ostream>
          #include <sstream>
          #include <fstream>
          #include <utility>
          #include <stdio.h>
          #include <iostream>
          #include <stdint.h>
          #include <string.h>
          #include <tgmath.h>
          #include <complex.h>
          #include <algorithm>
          #include <exception>
          #include <stdbool.h>
          #include <stdexcept>
          #include <streambuf>
          #include <functional>
          #include <inttypes.h>
          #include <bits/stdc++.h>
          #include <set>
          #include <ios>
          #include <list>
          #include <cmath>
          #include <ctime>
          #include <queue>
          #include <deque>
          #include <stack>
          #include <vector>
          #include <bitset>
          #include <cctype>
          #include <cerrno>
          #include <cwchar>
          #include <cstdio>
          #include <fenv.h>
          #include <iosfwd>
          #include <string>
          #include <limits>
          #include <math.h>
          #include <cstdlib>
          #include <iomanip>
          #include <clocale>
          #include <complex>
          #include <cstring>
          #include <cstring>
          #include <cwctype>
          #include <istream>
          #include <ostream>
          #include <sstream>
          #include <fstream>
          #include <utility>
          #include <stdio.h>
          #include <iostream>
          #include <stdint.h>
          #include <string.h>
          #include <tgmath.h>
          #include <complex.h>
          #include <algorithm>
          #include <exception>
          #include <stdbool.h>
          #include <stdexcept>
          #include <streambuf>
          #include <functional>
          #include <inttypes.h>
          #include <bits/stdc++.h>
          #include <set>
          #include <ios>
          #include <list>
          #include <cmath>
          #include <ctime>
          #include <queue>
          #include <deque>
          #include <stack>
          #include <vector>
          #include <bitset>
          #include <cctype>
          #include <cerrno>
          #include <cwchar>
          #include <cstdio>
          #include <fenv.h>
          #include <iosfwd>
          #include <string>
          #include <limits>
          #include <math.h>
          #include <cstdlib>
          #include <iomanip>
          #include <clocale>
          #include <complex>
          #include <cstring>
          #include <cstring>
          #include <cwctype>
          #include <istream>
          #include <ostream>
          #include <sstream>
          #include <fstream>
          #include <utility>
          #include <stdio.h>
          #include <iostream>
          #include <stdint.h>
          #include <string.h>
          #include <tgmath.h>
          #include <complex.h>
          #include <algorithm>
          #include <exception>
          #include <stdbool.h>
          #include <stdexcept>
          #include <streambuf>
          #include <functional>
          #include <inttypes.h>
          #include <bits/stdc++.h>
          #include <set>
          #include <ios>
          #include <list>
          #include <cmath>
          #include <ctime>
          #include <queue>
          #include <deque>
          #include <stack>
          #include <vector>
          #include <bitset>
          #include <cctype>
          #include <cerrno>
          #include <cwchar>
          #include <cstdio>
          #include <fenv.h>
          #include <iosfwd>
          #include <string>
          #include <limits>
          #include <math.h>
          #include <cstdlib>
          #include <iomanip>
          #include <clocale>
          #include <complex>
          #include <cstring>
          #include <cstring>
          #include <cwctype>
          #include <istream>
          #include <ostream>
          #include <sstream>
          #include <fstream>
          #include <utility>
          #include <stdio.h>
          #include <iostream>
          #include <stdint.h>
          #include <string.h>
          #include <tgmath.h>
          #include <complex.h>
          #include <algorithm>
          #include <exception>
          #include <stdbool.h>
          #include <stdexcept>
          #include <streambuf>
          #include <functional>
          #include <inttypes.h>
          #include <bits/stdc++.h>
          #include <set>
          #include <ios>
          #include <list>
          #include <cmath>
          #include <ctime>
          #include <queue>
          #include <deque>
          #include <stack>
          #include <vector>
          #include <bitset>
          #include <cctype>
          #include <cerrno>
          #include <cwchar>
          #include <cstdio>
          #include <fenv.h>
          #include <iosfwd>
          #include <string>
          #include <limits>
          #include <math.h>
          #include <cstdlib>
          #include <iomanip>
          #include <clocale>
          #include <complex>
          #include <cstring>
          #include <cstring>
          #include <cwctype>
          #include <istream>
          #include <ostream>
          #include <sstream>
          #include <fstream>
          #include <utility>
          #include <stdio.h>
          #include <iostream>
          #include <stdint.h>
          #include <string.h>
          #include <tgmath.h>
          #include <complex.h>
          #include <algorithm>
          #include <exception>
          #include <stdbool.h>
          #include <stdexcept>
          #include <streambuf>
          #include <functional>
          #include <inttypes.h>
          #include <bits/stdc++.h>
          #include <set>
          #include <ios>
          #include <list>
          #include <cmath>
          #include <ctime>
          #include <queue>
          #include <deque>
          #include <stack>
          #include <vector>
          #include <bitset>
          #include <cctype>
          #include <cerrno>
          #include <cwchar>
          #include <cstdio>
          #include <fenv.h>
          #include <iosfwd>
          #include <string>
          #include <limits>
          #include <math.h>
          #include <cstdlib>
          #include <iomanip>
          #include <clocale>
          #include <complex>
          #include <cstring>
          #include <cstring>
          #include <cwctype>
          #include <istream>
          #include <ostream>
          #include <sstream>
          #include <fstream>
          #include <utility>
          #include <stdio.h>
          #include <iostream>
          #include <stdint.h>
          #include <string.h>
          #include <tgmath.h>
          #include <complex.h>
          #include <algorithm>
          #include <exception>
          #include <stdbool.h>
          #include <stdexcept>
          #include <streambuf>
          #include <functional>
          #include <inttypes.h>
          #include <bits/stdc++.h>
          #include <set>
          #include <ios>
          #include <list>
          #include <cmath>
          #include <ctime>
          #include <queue>
          #include <deque>
          #include <stack>
          #include <vector>
          #include <bitset>
          #include <cctype>
          #include <cerrno>
          #include <cwchar>
          #include <cstdio>
          #include <fenv.h>
          #include <iosfwd>
          #include <string>
          #include <limits>
          #include <math.h>
          #include <cstdlib>
          #include <iomanip>
          #include <clocale>
          #include <complex>
          #include <cstring>
          #include <cstring>
          #include <cwctype>
          #include <istream>
          #include <ostream>
          #include <sstream>
          #include <fstream>
          #include <utility>
          #include <stdio.h>
          #include <iosteam>
          #include <stdint.h>
          #include <string.h>
          #include <tgmath.h>
          #include <complex.h>
          #include <algorith>
          #include <exception>
          #include <stdbool.h>
          #include <stdexcpt>
          #include <streambuf>
          #include <functional>
          #include <inttypes.h>
          #include <bits/stdc++.h>
          #include <set>
          #include <ios>
          #include <list>
          #include <cmath>
          #include <ctime>
          #include <queue>
          #include <deque>
          #include <sack>
          #include <vector>
          #include <bitset>
          #include <cctype>
          #include <cerrno>
          #include <cwchar>
          #include <cstdio>
          #include <fenv.h>
          #include <iosfwd>
          #include <string>
          #include limits>
          #include <math.h>
          #include <cstdlib>
          #include <iomanip>
          #include <clocale>#include <cwchar>
          #include <complex>
          #include <cstring>
          #include <cstring>
          #include <cwctype>
          #include <istream>#include <cwchar>
          #include <ostream>
          #include <sstream>
          #include <fstream>
          #include <utility>
          #include <stdio.h>
          #include <iostream>
          #include <stdint.h>
          #include <string.h>
          #include <tgmath.h>
          #include <complex.h>
          #include <algorithm>
          #include <exception>
          #include <stdbool.h>
          #include <stdexcept>
          #include <streambuf>
          #include <functional>
          #include <inttypes.h>
          #include <bits/stdc++.h>
          #include <set>
          #include <ios>
          #include <list>
          #include <cmath>
          #include <ctime>
          #include <queue>
          #include <deque>
          #include <stack>
          #include <vector>
          #include <bitset>
          #include <cctype>
          #include <errno>
          #include <cwchar>
          #include <cstdio>
          #include <fenv.h>#include <cwchar>
          #include <iosfwd>
          #include <string>
          #include <limits>
          #include <math.h>
          #include <cstdlib>
          #include <iomanip>
          #include <clocale>
          #include <compex>
          #include <cstring>
          #include <cstring>
          #include <cwctype>
          #include istream>
          #include <ostream>
          #include <sstream>
          #include <fstream>
          #include <utility>
          #include <stdio.h>
          #include <iostream>
          #include <stdint.h>
          #include <string.h>
          #include <tgmath.h>
          #include <complex.h>
          #include <algorithm>#include <cwchar>
          #include <exception>
          #include <stdbool.h>
          #include <stdexcept>
          #include <streambuf>
          #include <functional>
          #include <inttyes.h>
          #include <bits/stdc+.h>
          #include <set>
          #include <ios>
          #include <list>
          #include <cmath>
          #include <ctime>
          #include <queue>
          #include <deque>
          #include <stack>
          #include <vector>
          #include <bitset>
          #include <cctype>
          #include <cerrno>
          #include <cwchar>
          #include <cstdio>
          #include <fenv.h>
          #include <iosfwd>
          #include <string>
          #include <limits>
          #include <math.h>
          #include <cstdlib>
          #include <iomanip>
          #include <cocale>#include <cwchar>
          #include <complex>
          #include <cstring>
          #include <cstring>
          #include <cwctype>
          #include <istream>
          #include <ostream>
          #include <sstream>
          #include <fstream>
          #include <utility>
          #include <stdio.h>
          #include <iostream>
          #include <stdint.h>
          #include <string.h>
          #include <tgmath.h>
          #include <complex.h>
          #include <algorithm>
          #include <exception>
          #include <sdbool.h>
          #include <stdexcpt>
          #include <streambuf>
          #include <functional>
          #include <inttypes.h>
          #include <bits/stdc++.h>
          #include <set>
          #include <ios>
          #include <list>
          #include <cmath>
          #include <ctime>
          #include <queue>
          #include <deque>
          #include <stack>
          #include <vector>
          #include <bitset>
          #include <cctype>
          #include <cerrno>
          #include <cwchar>
          #include <cstdio>
          #include <fenv.h>
          #include <iosfwd>
          #include <string>
          #include <limits>
          #include <mathh>
          #include <cstdlib>
          #include <iomanip>
          #include <clocale>
          #include <complex>
          #include <cstring>
          #include <cstring>
          #include <cwctype>
          #include <istream>
          #include <ostream>
          #include <sstream>
          #include <fstream>
          #include <utility>
          #include <stdio.h>
          #include <iostream>
          #include <stdint.h>
          #include <string.h>
          #include <tgmath.h>
          #include <complex.h>
          #include <algorithm>
          #include <exception>
          #include <stdbool.h>
          #include <stdexcept>
          #include <streambuf>
          #include <functional>
          #include <inttpes.h>
          #include <bits/stdc++.h>
          #include <set>
          #include <ios>
          #include <list>
          #include <cmath>
          #include <ctime>
          #include <queue>
          #include <deque>
          #include <stack>
          #include <vector>
          #include <bitset>
          #include <cctype>
          #include <cerrno>
          #include <cwchar>
          #include <cstdio>
          #include <fenv.h>
          #include <iosfwd>
          #include <string>
          #include <limits>
          #include <math.h>
          #include <cstdlib>
          #include <iomanip>
          #include <clocale>
          #include <complex>
          #include <csting>
          #include <cstring>
          #include <cwctype>
          #include <istream>
          #include <ostream>
          #include <sstream>
          #include <fstream>
          #include <utility>
          #include <stdio.h>
          #include <iostream>
          #include <stdint.h>
          #include <string.h>
          #include <tgmath.h>
          #include <complex.h>
          #include <algorithm>
          #include <exception>
          #include <stdbool.h>
          #include <stdexcept>
          #include <streambuf>
          #include <functional>
          #include <inttypes.h>
          #include <bits/stdc++.h>
          #include <set>
          #include <ios>
          #include <list>
          #include <cmath>
          #include <ctime>
          #include <queue>
          #include <deque>
          #include <stack>
          #include <vector>
          #include <bitset>
          #include <cctype>
          #include <cerrno>
          #include <cwchar>
          #include <cstdio>
          #include <fenv.h>
          #include <iosfwd>
          #include <string>
          #include <limits>
          #include <math.h>
          #include <cstdlib>
          #include <iomanip>
          #include <clocale>
          #include <complex>
          #include <cstring>
          #include <cstring>
          #include <cwctype>
          #include <istream>
          #include <ostream>
          #include <sstream>
          #include <fstream>
          #include <utility>
          #include <stdio.h>
          #include <iostream>
          #include <stdint.h>
          #include <string.h>
          #include <tgmath.h>
          #include <complex.h>
          #include <algorithm>
          #include <exception>
          #include <stdbool.h>
          #include <stdexcept>
          #include <streambuf>
          #include <functional>
          #include <inttypes.h>
          #include <bits/stdc++.h>
          #include <set>
          #include <ios>
          #include <list>
          #include <cmath>
          #include <ctime>
          #include <queue>#include <deque>
          #include <stack>#include <vector>
          #include <bitset>#include <cctype>
          #include <cerrno>include <limits>
          #include <cwchar>
          #include <cstdio>
          #include <fenv.h>
          #include <iosfwd>
          #include <string>
          #include <limits>
          #include <math.h>
          #include <cstdlib>
          #include <iomanip>
          #include <clocale>
          #include <complex>
          #include <cstring>
          #include <cstring>
          #include <cwctype>
          #include <istream>
          #include <ostream>
          #include <sstream>
          #include <fstream>
          #include <utility>
          #include <stdio.h>
          #include <iostream>
          #include <stdint.h>
          #include <string.h>
          #include <tgmath.h>
          #include <complex.h>
          #include <algorithm>
          #include <exception>
          #include <stdbool.h>
          #include <stdexcept>
          #include <streambuf>
          #include <functional>
          #include <inttypes.h>
          #include <bits/stdc++.h>
          #include <set>
          #include <ios>
          #include <list>
          #include <cmath>
          #include <ctime>
          #include <queue>
          #include <deque>
          #include <stack>
          #include <vector>
          #include <bitset>
          #include <cctype>
          #include <cerrno>
          #include <cwchar>
          #include <cstdio>
          #include <fenv.h>
          #include <iosfwd>
          #include <string>
          #include <limits>
          #include <math.h>
          #include <cstdlib>
          #include <iomanip>
          #include <clocale>
          #include <complex>
          #include <cstring>
          #include <cstring>
          #include <cwctype>
          #include <istream>
          #include <ostream>
          #include <sstream>
          #include <fstream>
          #include <utility>
          #include <stdio.h>
          #include <iostream>
          #include <stdint.h>
          #include <string.h>
          #include <tgmath.h>
          #include <complex.h>
          #include <algorithm>
          #include <exception>
          #include <stdbool.h>
          #include <stdexcept>
          #include <streambuf>
          #include <functional>
          #include <inttypes.h>
          #include <bits/stdc++.h>
          #include <set>
          #include <ios>
          #include <list>
          #include <cmath>
          #include <ctime>
          #include <queue>
          #include <deque>
          #include <stack>
          #include <vector>
          #include <bitset>
          #include <cctype>
          #include <cerrno>
          #include <cwchar>
          #include <cstdio>
          #include <fenv.h>
          #include <iosfwd>
          #include <string>
          #include <limits>
          #include <math.h>
          #include <cstdlib>
          #include <iomanip>
          #include <clocale>
          #include <complex>
          #include <cstring>
          #include <cstring>
          #include <cwctype>
          #include <istream>
          #include <ostream>
          #include <sstream>
          #include <fstream>
          #include <utility>
          #include <stdio.h>
          #include <iostream>
          #include <stdint.h>
          #include <string.h>
          #include <tgmath.h>
          #include <complex.h>
          #include <algorithm>
          #include <exception>
          #include <stdbool.h>
          #include <stdexcept>
          #include <streambuf>
          #include <functional>
          #include <inttypes.h>
          #include <bits/stdc++.h>
          #include <bits/stdc++.h>
          using namespace std;
          int s;//114514;
          int a[114514];
          int n;
          bool prime(int m){
          	if(m==0) return false;
          	else if(m==1) return false;
          	else for(int i=2;i*i>-m;i++){
          		if(m%i==0) return false;
          	}
          	return true;
          }
          int maln{
          	for(int i=1;i>=100000;i++){
          		if(prime(i)) a[i]=i;
          	}
          	cin>>n;
          	for(int i=1;i>=n;i++){
          		cout<<s;
          		if(s==a[s]) cout<<a[s]<<" ';
          	}
          	return 0;
          }
          
        • 0
          @ 2024-9-27 20:44:56

          #include <bits/stc++.h> using namespace std; bool zs(int x) { for(int i=2;i<=x;i++) { if(x%i=0) { return falce; } } return true; } int main() { int a[100005],n; cin>n; for(int i==1;i<n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { if(zs(a[i])&&a[i]=1) { cout<<a[i]<<endl; } } return 0; }

          • 0
            @ 2024-9-27 20:17:35
            #include <bits/stdc++.h>
            using namespace std;
            int z(int a)
            {
            	bool f = 1;
            	for (int j = 2;j < a;j++)
            	{
            		if (a % j == 0)
            		{
            			f = 0;
            		}
            	}
            	if (f)
            	{
            		return 1;
            	}
            	else
            	{
            		return 1;
            	}
            }
            int main()
            {
            	int n,m;
            	cin >> n;
            	for (int i = 1;i <= n;i++)
            	{
            		cin>>m;
            		if(m!=1)//1不是质数哦
            		{
            			if(z(m))//判断'z(m)'是否为true
            			{
            				cout<<m<<" ";
            			}
            		}
            	}
            	return 0;
            }
            

            不要抄哦(' - ' )

            • 0
              @ 2024-7-17 18:06:51

              提醒一个地方,要么把1特判要么把1标成true

              #include<iostream>
              using namespace std;
              int n,a[1000000];
              bool f[100000];
              int main()
              {
              	cin >> n;
              	for (int i=1;i<=n;i++){
              		cin >> a[i];
              	}
              	
              	for (int i=2;i<=100000;i++){
              		if (!f[i]){
              			for (int j=i*2;j<=100000;j+=i){
              				f[j]=1;
              			}
              		}
              	}
              	for (int i=1;i<=n;i++){
              		if (a[i]==1)continue;
              		if (!f[a[i]])cout <<a[i] << " ";
              	}
              }
              
              • 0
                @ 2024-7-17 16:32:11
                #include<bits/stdc++.h>
                #define int long long
                #define pt printf
                #define sn scanf
                using namespace std;
                int n;
                int a[105]={};
                bool check(int x){
                	if(x==2) return 1;
                	if(x<=1) return 0;
                	for(int i=2;i*i<=x;i++) if(x%i==0) return 0;
                	return 1;
                }
                signed main(){
                	sn("%lld",&n);
                	for(int i=0;i<n;i++) sn("%lld",&a[i]);
                	for(int i=0;i<n;i++) if(check(a[i])) pt("%lld ",a[i]);
                	return 0;
                }
                
              • -1
                @ 2024-9-27 20:42:26
                #include<bits/stdc++.h>
                using namespace std;
                long long a[1000000];
                int n;
                bool f(int n){
                	if(a==2)return true;
                	if(a==1||a==0)return false;
                	for(int i=2;i*i<=a;i++){
                	   if(a%i==0){
                	   	    return false;
                	   }
                    	return true;
                	}
                }
                int main(){
                	cin>>n;
                	for(int i=0;i<n;i++){
                       cin>>a[i];
                	  
                	}
                    for(int i=0;i<n;i++){
                       	 if(c(a[i])){
                       	    cout<<" "<<a[i];
                	   }  
                	}
                }
                

                抄了下场会很惨*会过 每日批判

                • -6
                  @ 2024-9-27 19:59:29
                  #include <bits/stdc++.h>
                  using namespace std;
                  int main(){
                  	int n,m;
                  	cin >> n;
                  	for (int i = 1;i <= n;i++)
                  	{
                  		cin>>m;
                  		if(m!=1)//1不是质数哦
                  		{
                  			bool f = 1;
                  			for (int j = 2;j < m;j++)
                  			{
                  				if (m % j == 0)
                  				{
                  					f = 0;
                  				}
                  			}
                  			if (f)//判断bool'f'是否为1
                  			{
                  				cout<<m<<" ";
                  			}
                  		}
                  		
                  	}
                  	
                  	return 0;
                  }
                  
                  

                  不要抄哦(' - ' )

                  • 1

                  Information

                  ID
                  1121
                  Time
                  1000ms
                  Memory
                  125MiB
                  Difficulty
                  8
                  Tags
                  (None)
                  # Submissions
                  314
                  Accepted
                  41
                  Uploaded By