結果

問題 No.1255 ハイレーツ・オブ・ボリビアン
ユーザー 37zigen37zigen
提出日時 2020-10-10 00:52:37
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 463 bytes
コンパイル時間 82 ms
コンパイル使用メモリ 10,972 KB
実行使用メモリ 7,972 KB
最終ジャッジ日時 2023-09-27 20:32:11
合計ジャッジ時間 8,689 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 14 ms
7,756 KB
testcase_01 AC 14 ms
7,760 KB
testcase_02 AC 15 ms
7,740 KB
testcase_03 AC 16 ms
7,796 KB
testcase_04 AC 16 ms
7,796 KB
testcase_05 AC 25 ms
7,912 KB
testcase_06 AC 22 ms
7,820 KB
testcase_07 AC 22 ms
7,820 KB
testcase_08 AC 794 ms
7,824 KB
testcase_09 AC 863 ms
7,880 KB
testcase_10 AC 840 ms
7,736 KB
testcase_11 AC 853 ms
7,912 KB
testcase_12 AC 861 ms
7,820 KB
testcase_13 AC 94 ms
7,724 KB
testcase_14 TLE -
testcase_15 AC 787 ms
7,872 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