結果

問題 No.1312 Snake Eyes
ユーザー Nzt3
提出日時 2020-12-09 01:04:40
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 310 bytes
コンパイル時間 1,531 ms
コンパイル使用メモリ 165,324 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-09-18 22:37:30
合計ジャッジ時間 4,516 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 33 WA * 52
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main(){
  int64_t n;
  cin>>n;
  int64_t ans=(n<=2?n:n-1);
  for(int64_t i=2;i*i<=n;i++){
    bool ok=true;
    int64_t d=n,t=n%i;
    while(d!=0){
      if(d%i!=t)ok=false;
      d/=i;
    }
    if(ok){
      ans=i;
      break;
    }
  }
  cout<<ans<<'\n';
}
0