Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- //#include <ext/pb_ds/assoc_container.hpp>
- //using namespace __gnu_pbds;
- using namespace std;
- #define int long long
- #define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
- const long long INF = 1e18 + 7;
- const double EPS = 1e-6;
- const int MOD = 1e9 + 7;
- const int MAXN = 2e5 + 100;
- int n = 1046527;
- bool is_prime(int a) {
- if (a == 1) {
- return false;
- }
- for (int i = 2; i * i <= a; ++i) {
- if (a % i == 0) {
- return false;
- }
- }
- return true;
- }
- inline void solve() {
- int ans = 0;
- for (int i = 0; i < n; ++i) {
- if (n - 2 * i > 0 && is_prime(n - 2 * i)) {
- ans = max(ans, n - 2 * i);
- }
- }
- cout << ans << '\n';
- }
- int32_t main() {
- IOS;
- int tt = 1;
- // cin >> tt;
- while (tt --> 0) {
- solve();
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment