結果

問題 No.312 置換処理
ユーザー imulan
提出日時 2016-02-10 21:52:04
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 12 ms / 2,000 ms
コード長 506 bytes
コンパイル時間 1,361 ms
コンパイル使用メモリ 157,536 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-15 12:02:08
合計ジャッジ時間 2,508 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 45
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
#define rep(i,n) for(i=0;i<n;++i)
#define each(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); itr++)
#define mp make_pair
#define pb push_back
#define fi first
#define sc second

int main(int argc, char const *argv[]) {
  ll n;
  cin >>n;

  ll ans=n;

  for(ll i=3; i*i<=n; ++i){
    if(n%i==0){
      ans=i;
      break;
    }
  }

  if(ans==n && ans%2==0 && ans>4) ans/=2;

  std::cout << ans << std::endl;
  return 0;
}
0