結果

問題 No.414 衝動
ユーザー kitayankitayan
提出日時 2016-10-14 16:06:16
言語 Python2
(2.7.18)
結果
RE  
実行時間 -
コード長 510 bytes
コンパイル時間 53 ms
コンパイル使用メモリ 7,040 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-05-01 22:58:11
合計ジャッジ時間 1,690 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 AC 11 ms
6,144 KB
testcase_02 AC 10 ms
6,144 KB
testcase_03 RE -
testcase_04 RE -
testcase_05 AC 11 ms
6,144 KB
testcase_06 AC 11 ms
6,272 KB
testcase_07 AC 10 ms
6,144 KB
testcase_08 AC 10 ms
6,144 KB
testcase_09 RE -
testcase_10 AC 11 ms
6,144 KB
testcase_11 RE -
testcase_12 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#! usr/bin/env python
# -*- coding:utf-8 -*-

def is_prime(q):
    q = abs(q)
    if q == 2: return True
    if q < 2 or q & 1 == 0: return False
    return pow(2,q-1,q) == 1

if __name__ == "__main__":
    M = raw_input()
    M = int(M)

    ans1 = 1
    ans2 = M

    if is_prime(M):
        print "1 " + str(ans2)
        exit()

    for i in range(2,M):
        if is_prime(i):
            if M % i == 0:
                ans1 = str(i)
                ans2 = str(M/i)

    print str(ans1) + " " + str(ans2)
0