結果

問題 No.1255 ハイレーツ・オブ・ボリビアン
ユーザー 37zigen37zigen
提出日時 2020-10-10 00:54:40
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 238 ms / 2,000 ms
コード長 463 bytes
コンパイル時間 266 ms
コンパイル使用メモリ 87,256 KB
実行使用メモリ 76,244 KB
最終ジャッジ日時 2023-09-30 14:46:17
合計ジャッジ時間 2,938 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,452 KB
testcase_01 AC 71 ms
71,552 KB
testcase_02 AC 77 ms
76,204 KB
testcase_03 AC 75 ms
75,836 KB
testcase_04 AC 81 ms
75,648 KB
testcase_05 AC 84 ms
75,856 KB
testcase_06 AC 84 ms
76,196 KB
testcase_07 AC 83 ms
76,148 KB
testcase_08 AC 151 ms
76,236 KB
testcase_09 AC 151 ms
76,236 KB
testcase_10 AC 150 ms
76,180 KB
testcase_11 AC 151 ms
76,056 KB
testcase_12 AC 153 ms
76,244 KB
testcase_13 AC 85 ms
75,868 KB
testcase_14 AC 238 ms
75,856 KB
testcase_15 AC 149 ms
76,172 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

T=int(input())
for t in range(T):
    n=int(input())
    n=2*n-1
    m=n
    ord=n
    d=2
    while n>1:
        if n%d==0:
            ord-=ord//d
        while n%d==0:
            n//=d
        d+=1
        if d*d>n:
            d=n
    d=1
    ans=10**10
    while d*d<=ord:
        if ord%d==0:
            if pow(2,d,m)==1%m:
                ans=min(ans,d)
            if pow(2,ord//d,m)==1%m:
                ans=min(ans,ord//d)
        d+=1
    print(ans)
0