結果

問題 No.1255 ハイレーツ・オブ・ボリビアン
ユーザー 👑 rin204rin204
提出日時 2022-01-27 22:37:44
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 645 bytes
コンパイル時間 350 ms
コンパイル使用メモリ 87,292 KB
実行使用メモリ 76,848 KB
最終ジャッジ日時 2023-08-27 01:00:39
合計ジャッジ時間 3,383 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,644 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 212 ms
76,396 KB
testcase_15 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve():
    n = 2 * int(input()) - 1
    if n == 1:
        print(1)
        return
    eu = n
    x = n
    for i in range(2, int(n ** 0.5 + 1)):
        if n % i == 0:
            eu *= i - 1
            eu //= i
            while x % i == 0:
                x //= i
    if x != 1:
        eu *= x - 1
        eu //= x
    
    div = []
    for i in range(1, int(n ** 0.5 + 1)):
        if eu % i == 0:
            div.append(i)
            div.append(eu // i)
            
    div.sort()
    for i in div:
        if pow(2, i, n) == 1:
            print(i)
            return
    
    
    
for _ in range(int(input())):
    solve()
    
0