結果
| 問題 |
No.1312 Snake Eyes
|
| コンテスト | |
| ユーザー |
hiro71687k
|
| 提出日時 | 2023-05-06 04:57:53 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 921 bytes |
| コンパイル時間 | 4,123 ms |
| コンパイル使用メモリ | 249,748 KB |
| 最終ジャッジ日時 | 2025-02-12 20:24:43 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 57 WA * 15 TLE * 13 |
ソースコード
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll=long long;
using ld=long double;
ld pie=3.141592653589793;
ll inf=14449999999999999;
ll mod=998244353;
int main(){
ll n;
cin >> n;
ll ans=n-1;
for (ll i = 2; i >=0; i++)
{
bool ok=false;
for (ll j = 2; j >=0; j++)
{
ll x=0;
ll now=1;
for (ll k = 0; k < i; k++)
{
if (x>n)
{
break;
}
x+=now;
now*=j;
}
if (x>n)
{
break;
}
if (n%x==0&&n/x<j)
{
ok=true;
ans=j;
break;
}
}
if (!ok)
{
break;
}
}
cout << ans << endl;
}
hiro71687k