結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 13 ms
7,940 KB
testcase_01 AC 15 ms
7,860 KB
testcase_02 AC 16 ms
7,932 KB
testcase_03 AC 16 ms
7,964 KB
testcase_04 AC 16 ms
7,872 KB
testcase_05 AC 23 ms
7,896 KB
testcase_06 AC 23 ms
7,860 KB
testcase_07 AC 24 ms
7,872 KB
testcase_08 AC 818 ms
7,968 KB
testcase_09 AC 904 ms
8,060 KB
testcase_10 AC 863 ms
7,868 KB
testcase_11 AC 886 ms
7,872 KB
testcase_12 AC 792 ms
7,940 KB
testcase_13 AC 97 ms
7,872 KB
testcase_14 TLE -
testcase_15 AC 816 ms
7,864 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