Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int pr[]= {2,3,5,7,11,13,17,19,23,29,31};
- unsigned long long int perfecte[20];
- unsigned long long int p=1,putere=0,a;
- for(int i=0; i<11; i++)
- {
- for(int j=putere; j<pr[i]-1; j++)
- p=p*2;
- putere=pr[i]-1;
- perfecte[i]=p*(p*2-1);
- }
- int n;
- cin>>n;
- for(int i=1; i<=n; i++)
- {
- cin>>a;
- int ok=0;
- for(int j=0; j<11&&!ok; j++)
- if(perfecte[j]==a)
- {
- ok=1;
- }
- cout<<ok<<" ";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement