結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,844 KB
testcase_01 AC 16 ms
8,068 KB
testcase_02 AC 16 ms
7,892 KB
testcase_03 AC 17 ms
8,052 KB
testcase_04 AC 16 ms
8,064 KB
testcase_05 AC 26 ms
7,920 KB
testcase_06 AC 25 ms
7,856 KB
testcase_07 AC 26 ms
7,928 KB
testcase_08 AC 824 ms
8,024 KB
testcase_09 AC 944 ms
7,924 KB
testcase_10 AC 885 ms
7,976 KB
testcase_11 AC 812 ms
8,032 KB
testcase_12 AC 810 ms
8,008 KB
testcase_13 AC 93 ms
7,892 KB
testcase_14 TLE -
testcase_15 AC 801 ms
8,048 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