結果

問題 No.192 合成数
ユーザー parsee1053
提出日時 2020-06-20 18:04:13
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 538 bytes
コンパイル時間 578 ms
コンパイル使用メモリ 72,644 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-03 17:30:43
合計ジャッジ時間 1,793 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;

#define MOD 1000000007

int main() {
  int n;
  cin >> n;
  for (int m = n - 100; m <= n + 100; ++m) {
    bool ok = false;
    for (int i = 2; i * i <= m; ++i) {
      if (m % i == 0) ok = true;
    }
    if (ok) {
      cout << m << endl;
      return 0;
    }
  }
  return 0;
}
0