結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,264 KB
testcase_01 AC 76 ms
71,364 KB
testcase_02 AC 84 ms
76,384 KB
testcase_03 AC 80 ms
75,932 KB
testcase_04 AC 81 ms
75,740 KB
testcase_05 AC 87 ms
76,112 KB
testcase_06 AC 87 ms
76,256 KB
testcase_07 AC 87 ms
76,160 KB
testcase_08 AC 156 ms
76,040 KB
testcase_09 AC 156 ms
76,284 KB
testcase_10 AC 157 ms
76,168 KB
testcase_11 AC 154 ms
75,900 KB
testcase_12 AC 156 ms
76,320 KB
testcase_13 AC 88 ms
75,932 KB
testcase_14 AC 240 ms
76,204 KB
testcase_15 AC 151 ms
76,184 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 d*d<=n:
        flag=False
        while n%d==0:
            n//=d
            flag=True
        if flag:
            ord-=ord//d
        d+=1
    if n>1:
        ord-=ord//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