結果

問題 No.1232 2^x = x
コンテスト
ユーザー lam6er
提出日時 2025-03-31 17:50:38
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
TLE  
実行時間 -
コード長 596 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 223 ms
コンパイル使用メモリ 95,976 KB
実行使用メモリ 162,612 KB
最終ジャッジ日時 2026-07-08 05:23:24
合計ジャッジ時間 5,623 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 1 TLE * 1 -- * 1
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

def main():
    import sys
    input = sys.stdin.read().split()
    N = int(input[0])
    primes = list(map(int, input[1:N+1]))
    
    for p in primes:
        if p == 2:
            print(2)
            continue
        
        found = False
        # Check x from 1 to 100_000
        max_check = 100000
        for x in range(1, max_check + 1):
            if pow(2, x, p) == x % p:
                print(x)
                found = True
                break
        
        if not found:
            x = (p - 1) ** 2
            print(x)
            
if __name__ == "__main__":
    main()
0