1 solutions
-
0
C++ :
#include<iostream> using namespace std; bool is_prime(int x) { for(int i=2; i<=x/i; i++) if(x%i==0) return 0; return 1; } int main() { int n; bool have = 0; cin >> n; for(int i=3; i<= n-2; i++){ if(is_prime(i)&&is_prime(i+2)){ have = 1; cout << i << ' ' << i+2 << endl; } } if(!have) cout << "empty" << endl; return 0; }
- 1
Information
- ID
- 18932
- Time
- 1000ms
- Memory
- 128MiB
- Difficulty
- (None)
- Tags
- # Submissions
- 0
- Accepted
- 0
- Uploaded By