結果
| 問題 |
No.1312 Snake Eyes
|
| コンテスト | |
| ユーザー |
SSRS
|
| 提出日時 | 2020-12-09 00:05:11 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 743 bytes |
| コンパイル時間 | 1,401 ms |
| コンパイル使用メモリ | 168,624 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-09-18 21:53:09 |
| 合計ジャッジ時間 | 5,188 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 83 WA * 2 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(){
long long N;
cin >> N;
bool ok = false;
for (long long i = 2; i <= N; i++){
long long N2 = N;
vector<int> A;
while (N2 > 0){
A.push_back(N2 % i);
N2 /= i;
}
bool same = true;
int cnt = A.size();
for (int j = 1; j < cnt; j++){
if (A[j] != A[0]){
same = false;
}
}
if (same){
cout << i << endl;
ok = true;
break;
}
if (A.size() <= 2){
break;
}
}
if (!ok){
for (int i = (int) sqrt(N); i >= 1; i--){
if (N % i == 0){
long long b = N / i - 1;
if (b > i && N / b == N % b){
cout << b << endl;
break;
}
}
}
}
}
SSRS