結果

問題 No.1312 Snake Eyes
ユーザー ytftytft
提出日時 2021-05-24 04:45:07
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 692 bytes
コンパイル時間 6,798 ms
コンパイル使用メモリ 390,968 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-20 14:36:53
合計ジャッジ時間 16,272 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,816 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 2 ms
6,944 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 2 ms
6,940 KB
testcase_06 AC 2 ms
6,944 KB
testcase_07 AC 1 ms
6,944 KB
testcase_08 AC 1 ms
6,940 KB
testcase_09 AC 1 ms
6,944 KB
testcase_10 AC 2 ms
6,944 KB
testcase_11 AC 1 ms
6,940 KB
testcase_12 AC 2 ms
6,940 KB
testcase_13 AC 1 ms
6,944 KB
testcase_14 AC 2 ms
6,940 KB
testcase_15 AC 2 ms
6,940 KB
testcase_16 AC 2 ms
6,944 KB
testcase_17 WA -
testcase_18 AC 2 ms
6,940 KB
testcase_19 AC 1 ms
6,940 KB
testcase_20 AC 2 ms
6,944 KB
testcase_21 AC 2 ms
6,940 KB
testcase_22 AC 1 ms
6,944 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 2 ms
6,940 KB
testcase_27 AC 2 ms
6,944 KB
testcase_28 WA -
testcase_29 AC 2 ms
6,944 KB
testcase_30 WA -
testcase_31 AC 2 ms
6,944 KB
testcase_32 AC 2 ms
6,940 KB
testcase_33 AC 2 ms
6,944 KB
testcase_34 AC 2 ms
6,940 KB
testcase_35 AC 2 ms
6,940 KB
testcase_36 AC 2 ms
6,940 KB
testcase_37 AC 1 ms
6,944 KB
testcase_38 WA -
testcase_39 AC 14 ms
6,940 KB
testcase_40 AC 12 ms
6,940 KB
testcase_41 WA -
testcase_42 AC 4 ms
6,940 KB
testcase_43 WA -
testcase_44 AC 5 ms
6,944 KB
testcase_45 AC 9 ms
6,944 KB
testcase_46 WA -
testcase_47 AC 7 ms
6,940 KB
testcase_48 WA -
testcase_49 WA -
testcase_50 AC 223 ms
6,940 KB
testcase_51 WA -
testcase_52 AC 367 ms
6,940 KB
testcase_53 AC 264 ms
6,940 KB
testcase_54 AC 309 ms
6,940 KB
testcase_55 AC 147 ms
6,944 KB
testcase_56 WA -
testcase_57 AC 198 ms
6,940 KB
testcase_58 WA -
testcase_59 AC 99 ms
6,940 KB
testcase_60 AC 193 ms
6,944 KB
testcase_61 AC 357 ms
6,940 KB
testcase_62 AC 135 ms
6,940 KB
testcase_63 WA -
testcase_64 AC 13 ms
6,940 KB
testcase_65 AC 40 ms
6,944 KB
testcase_66 WA -
testcase_67 AC 2 ms
6,944 KB
testcase_68 AC 17 ms
6,940 KB
testcase_69 WA -
testcase_70 AC 282 ms
6,940 KB
testcase_71 AC 167 ms
6,944 KB
testcase_72 AC 16 ms
6,940 KB
testcase_73 AC 3 ms
6,940 KB
testcase_74 AC 2 ms
6,944 KB
testcase_75 AC 2 ms
6,944 KB
testcase_76 WA -
testcase_77 AC 359 ms
6,944 KB
testcase_78 AC 357 ms
6,940 KB
testcase_79 AC 261 ms
6,944 KB
testcase_80 AC 351 ms
6,940 KB
testcase_81 AC 348 ms
6,944 KB
testcase_82 WA -
testcase_83 WA -
testcase_84 AC 352 ms
6,940 KB
testcase_85 AC 332 ms
6,940 KB
testcase_86 WA -
testcase_87 AC 172 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#include <boost/multiprecision/cpp_int.hpp>
typedef boost::multiprecision::cpp_int mp;

mp pow(mp a,mp b){
    mp ans=1;
    mp temp=a;
    while(b>0){
        if(b%2){
            ans*=temp;
        }
        temp=temp*temp;
        b=b/2;
    }
    return ans;
}

int main(){
    mp N;
    cin>>N;
    mp ans=0;
    for(mp x=1;x*x+x<N;x++){
        if(N%x==0){
            ans=N/x-1;
        }
    }
    for(mp K=3;N+1>=pow(2,K);++K){
        for(mp p=2;pow(p,K-1)<=N;++p){
            if(N%(mp)((pow(p,K)-1)/(p-1))==0){
                cerr<<p<<' '<<K<<endl;
                ans=min(ans,p);
            }
        }
    }
    cout<<ans<<endl;
}
0