結果

問題 No.312 置換処理
ユーザー nCk_cvnCk_cv
提出日時 2015-12-06 23:32:25
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 456 bytes
コンパイル時間 466 ms
コンパイル使用メモリ 70,996 KB
実行使用メモリ 4,480 KB
最終ジャッジ日時 2023-10-12 17:49:52
合計ジャッジ時間 2,032 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 9 ms
4,348 KB
testcase_02 AC 12 ms
4,352 KB
testcase_03 AC 12 ms
4,352 KB
testcase_04 AC 1 ms
4,348 KB
testcase_05 AC 1 ms
4,352 KB
testcase_06 WA -
testcase_07 AC 5 ms
4,348 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 3 ms
4,352 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 1 ms
4,352 KB
testcase_23 AC 1 ms
4,352 KB
testcase_24 AC 1 ms
4,352 KB
testcase_25 AC 2 ms
4,348 KB
testcase_26 AC 2 ms
4,352 KB
testcase_27 AC 2 ms
4,352 KB
testcase_28 AC 1 ms
4,352 KB
testcase_29 AC 2 ms
4,352 KB
testcase_30 AC 3 ms
4,352 KB
testcase_31 WA -
testcase_32 AC 2 ms
4,352 KB
testcase_33 AC 5 ms
4,348 KB
testcase_34 AC 5 ms
4,348 KB
testcase_35 AC 2 ms
4,480 KB
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 AC 1 ms
4,352 KB
testcase_40 WA -
testcase_41 WA -
testcase_42 AC 2 ms
4,348 KB
testcase_43 AC 1 ms
4,348 KB
testcase_44 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <string>
#include <map>
#include <queue>
#define ll long long

int main() {
  ll N;
  std::cin >> N;
  ll ss = sqrt(N)+1L;
  ll ans = -1L;
  for(ll i = 3L; i <= ss; i++) {
    if(N % i == 0L) {
      ans = i;
      break;
    }
  }
  if(ans == -1L) {
    ans = N;
  }
  if(N % 2 == 0 && N >= 6) {
    ans = N/2;
  }
  std::cout << ans << std::endl;
}
0