Advertisement
Guest User

Rohatin-Andrei

a guest
Nov 21st, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4. int ciur[20001];
  5. void eratostene()
  6. {
  7. ciur[0]=ciur[1]=1;
  8. for(int i=2;i*i<=20000;i++)
  9. if(ciur[i]==0)
  10. for(int j=2;j*i<=20000;j++)
  11. ciur[i*j]=1;
  12. return;
  13. }
  14. long long a[10001];
  15. int main()
  16. {
  17. int n,x,maxi=-1;
  18. long long nr=0;
  19. cin>>n;
  20. eratostene();
  21. for(int i=0;i<n;i++)
  22. {
  23. cin>>x;
  24. a[x]++;
  25. }
  26. nr+=a[1]*(a[1]-1)/2;
  27. nr+=a[0]*a[2];
  28. */
  29. for(int i=0;i<=10000;i++)
  30. for(int j=i+1;j<=10000;j+=2)
  31. if(ciur[i+j]==0)
  32. nr+=a[i]*a[j];
  33. cout<<nr;
  34. return 0;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement