結果
| 問題 |
No.1312 Snake Eyes
|
| コンテスト | |
| ユーザー |
milanis48663220
|
| 提出日時 | 2020-12-09 00:12:59 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,081 bytes |
| コンパイル時間 | 1,027 ms |
| コンパイル使用メモリ | 94,500 KB |
| 最終ジャッジ日時 | 2025-01-16 20:06:00 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 83 WA * 2 |
ソースコード
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cassert>
#define debug_value(x) cerr << "line" << __LINE__ << ":<" << __func__ << ">:" << #x << "=" << x << endl;
#define debug(x) cerr << "line" << __LINE__ << ":<" << __func__ << ">:" << x << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using namespace std;
typedef long long ll;
bool ok(ll n, ll m){
ll tmp = m;
set<ll> st;
while(n){
st.insert(n%m);
n /= m;
}
return st.size() == 1;
}
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
cout << setprecision(10) << fixed;
ll n; cin >> n;
ll ans = 1e15;
for(ll m = 2; m*m <= n; m++){
if(ok(n, m)) chmin(ans, m);
}
for(ll k = 1; k*k <= n; k++){
if(n%k != 0) continue;
ll m = (n/k)-1;
if(k < m) chmin(ans, m);
}
cout << ans << endl;
}
milanis48663220