結果
問題 | No.638 Sum of "not power of 2" |
ユーザー |
![]() |
提出日時 | 2018-01-26 23:10:44 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 36 ms / 1,000 ms |
コード長 | 356 bytes |
コンパイル時間 | 216 ms |
コンパイル使用メモリ | 12,800 KB |
実行使用メモリ | 10,880 KB |
最終ジャッジ日時 | 2024-12-30 02:25:32 |
合計ジャッジ時間 | 1,352 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 12 |
ソースコード
import mathN = int(input())two_pow = [1]bit = 1while bit < N:bit <<= 1two_pow.append(bit)if N % 2 == 1:if N < 9:print(-1)else:num = 3while (num in two_pow) or ((N-num) in two_pow):num += 1else:print(str(num) + " " + str(N-num))else:if N < 6:print(-1)else:print(str(min(3,N-3)) + " " + str(max(3,N-3)))