結果

問題 No.638 Sum of "not power of 2"
ユーザー _shiro_k_shiro_k
提出日時 2018-01-27 00:13:55
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 388 bytes
コンパイル時間 65 ms
コンパイル使用メモリ 10,636 KB
実行使用メモリ 8,052 KB
最終ジャッジ日時 2023-08-28 18:16:19
合計ジャッジ時間 967 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,968 KB
testcase_01 RE -
testcase_02 AC 16 ms
8,032 KB
testcase_03 RE -
testcase_04 RE -
testcase_05 AC 14 ms
7,892 KB
testcase_06 RE -
testcase_07 AC 14 ms
7,988 KB
testcase_08 RE -
testcase_09 WA -
testcase_10 AC 15 ms
7,992 KB
testcase_11 AC 15 ms
7,936 KB
testcase_12 AC 16 ms
7,928 KB
testcase_13 AC 15 ms
7,840 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import math

N = int(input())
r = 0
if N%2 == 0:
    r = N/2
else:
    r = N//2 + 1
findNum = False
top = 0
bottom = 0

for i in range(1, r):
    top = i
    bottom = N - i
    res1, _ = math.modf(math.log2(top))
    res2, _ = math.modf(math.log2(bottom))
    if res1 != 0 and res2 != 0:
        findNum = True
        break

if findNum:
    print(top, " ", bottom)
else:
    print("-1")
0