Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- using namespace std;
- bool esPrimer(int a){
- if(a==0 || a==1) return false;
- else{
- for(int i=2;i*i<=a;++i){
- if(a%i==0) return false;
- }
- return true;
- }
- }
- int main(){
- int n;
- while(cin>>n){
- if(n>0){
- vector <int> A(n,0);
- for(int i=0;i<A.size();++i) cin>>A[i];
- bool trobat=false;
- int i=0,j=0;
- while(!trobat && i<A.size()-1){
- j=i+1;
- while(!trobat && j<A.size()){
- if(esPrimer(A[i]+A[j])) trobat=true;
- else ++j;
- }
- ++i;
- }
- if(trobat) cout<<"si"<<endl;
- else cout<<"no"<<endl;
- }
- else cout<<"no"<<endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement