結果

問題 No.1255 ハイレーツ・オブ・ボリビアン
ユーザー tamatotamato
提出日時 2020-10-10 00:19:42
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,084 bytes
コンパイル時間 279 ms
コンパイル使用メモリ 87,496 KB
実行使用メモリ 76,648 KB
最終ジャッジ日時 2023-09-27 20:23:08
合計ジャッジ時間 3,147 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,732 KB
testcase_01 AC 80 ms
71,708 KB
testcase_02 AC 79 ms
75,496 KB
testcase_03 AC 80 ms
75,656 KB
testcase_04 AC 79 ms
75,640 KB
testcase_05 AC 84 ms
76,340 KB
testcase_06 AC 84 ms
76,308 KB
testcase_07 AC 84 ms
76,236 KB
testcase_08 AC 177 ms
76,372 KB
testcase_09 AC 173 ms
76,316 KB
testcase_10 AC 175 ms
76,412 KB
testcase_11 AC 177 ms
76,284 KB
testcase_12 AC 178 ms
76,648 KB
testcase_13 WA -
testcase_14 AC 229 ms
76,272 KB
testcase_15 AC 174 ms
76,160 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 1000000007
eps = 10**-9


def main():
    import sys
    input = sys.stdin.readline

    def PrimeDecomposition(N):
        ret = {}
        n = int(N ** 0.5)
        for d in range(2, n + 1):
            while N % d == 0:
                if d not in ret:
                    ret[d] = 1
                else:
                    ret[d] += 1
                N //= d
            if N == 1:
                break
        if N != 1:
            ret[N] = 1
        return ret

    def euler_phi(N):
        P = PrimeDecomposition(N)
        ret = N
        for p in P:
            ret = ret * (p-1) // p
        return ret

    for _ in range(int(input())):
        N = int(input())
        phi = euler_phi(2 * N - 1)
        div = []
        for i in range(1, phi + 1):
            if i * i > phi:
                break
            if phi % i == 0:
                div.append(i)
                div.append(phi // i)
        div.sort()
        for d in div:
            if pow(2, d, 2*N-1) == 1:
                print(d)
                break


if __name__ == '__main__':
    main()
0