結果
問題 |
No.638 Sum of "not power of 2"
|
ユーザー |
![]() |
提出日時 | 2018-01-26 22:46:10 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 287 bytes |
コンパイル時間 | 86 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 11,008 KB |
最終ジャッジ日時 | 2024-12-30 02:21:12 |
合計ジャッジ時間 | 1,228 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 9 WA * 3 |
ソースコード
import math N = int(input()) two_pow = [1] bit = 1 while bit < N: bit <<= 1 two_pow.append(bit) if N % 2 == 1: n = N - 3 while (n in two_pow) and n > 0: n -= 2 if n == 0: print(-1) else: print(str(min(N-n,n)) + " " + str(max(N-n,n))) else: print("3" + " " + str(N-3))