結果
問題 | No.638 Sum of "not power of 2" |
ユーザー | takeya_okino |
提出日時 | 2019-09-17 19:30:35 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 545 bytes |
コンパイル時間 | 2,451 ms |
コンパイル使用メモリ | 71,440 KB |
実行使用メモリ | 57,200 KB |
最終ジャッジ日時 | 2023-09-21 20:13:51 |
合計ジャッジ時間 | 4,365 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 123 ms
56,076 KB |
testcase_01 | AC | 123 ms
56,032 KB |
testcase_02 | AC | 119 ms
55,748 KB |
testcase_03 | AC | 120 ms
54,428 KB |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | AC | 118 ms
56,008 KB |
testcase_13 | WA | - |
ソースコード
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); long n = sc.nextLong(); long ans = -1; if(n == 6) ans = 3; if(n > 6) { for(long i = 3; i <= 6; i++) { if(i != 4) { long t = n - i; int p = 0; while(t % 2 == 0) { t /= 2; if(t % 2 == 1) p++; } if(p > 0) { ans = i; break; } } } } System.out.println(ans); } }