結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
71,596 KB
testcase_01 AC 77 ms
71,416 KB
testcase_02 AC 82 ms
76,308 KB
testcase_03 AC 80 ms
75,732 KB
testcase_04 AC 80 ms
75,648 KB
testcase_05 AC 89 ms
76,340 KB
testcase_06 AC 88 ms
76,328 KB
testcase_07 AC 89 ms
76,400 KB
testcase_08 AC 157 ms
75,884 KB
testcase_09 AC 157 ms
76,280 KB
testcase_10 AC 156 ms
75,996 KB
testcase_11 AC 156 ms
76,252 KB
testcase_12 AC 157 ms
76,136 KB
testcase_13 AC 90 ms
76,440 KB
testcase_14 AC 243 ms
75,988 KB
testcase_15 AC 153 ms
76,368 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import math

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