結果

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

ソースコード

diff #

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

int main(){
  int64_t n;
  cin>>n;
  int64_t ans=(n<=2?2:n-1);
  for(int64_t i=2;i*i<=n*2;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