Run ID Author Problem Lang Verdict Time Memory Code Length Submit Time
39106 老方 斐波那契数列里的质数 C++ Wrong Answer 1 MS 248 KB 391 2024-01-30 18:32:53

Tests(0/5):


#include<bits/stdc++.h> using namespace std; bool isp(int n){ for(int i=2;i*i<=n;i++)if(n%i==0)return false; return true; } int main(){ int n,a=1,b=1,c=2,ns[41]={1,1}; cin>>n; cout<<"1 1 "; for(int i=2;i<n;i++){ ns[i]=c; cout<<c<<' '; a=b; int t=a; b=c; c=t+b; } cout<<endl; for(int i=2;i<n;i++){ if(isp(ns[i]))cout<<ns[i]<<' '; } return 0; }


Judgement Protocol: