fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int getAns() {
  5. int notPrime[2005] = {0};
  6. notPrime[1] = 1;
  7. for(int i = 2; i <= 2000; i++) {
  8. if(notPrime[i] == 0) {
  9. for(int j = 2 * i; j <= 2000; j += i) {
  10. notPrime[j] = 1;
  11. }
  12. }
  13. }
  14.  
  15. int cnt = 0;
  16. for(int i = 1; i <= 1000; i++) {
  17. for(int j = i + 1; j <= 1000; j++) {
  18. for(int k = j + 1; k <= 1000; k++) {
  19. if(!(notPrime[i + j] || notPrime[j + k] || notPrime[i + k])) cnt++;
  20. }
  21. }
  22. }
  23. return cnt;
  24. }
  25.  
  26. int main() {
  27. cout << getAns();
  28. return 0;
  29. }
Success #stdin #stdout 0.17s 5292KB
stdin
Standard input is empty
stdout
Standard output is empty