結果

問題 No.638 Sum of "not power of 2"
ユーザー YamaKasaYamaKasa
提出日時 2018-09-30 17:23:10
言語 Java21
(openjdk 21)
結果
AC  
実行時間 131 ms / 1,000 ms
コード長 518 bytes
コンパイル時間 2,363 ms
コンパイル使用メモリ 76,520 KB
実行使用メモリ 42,084 KB
最終ジャッジ日時 2024-04-20 13:42:44
合計ジャッジ時間 4,241 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 115 ms
41,608 KB
testcase_01 AC 126 ms
41,568 KB
testcase_02 AC 108 ms
41,676 KB
testcase_03 AC 106 ms
40,624 KB
testcase_04 AC 128 ms
41,696 KB
testcase_05 AC 106 ms
40,356 KB
testcase_06 AC 128 ms
41,872 KB
testcase_07 AC 113 ms
40,420 KB
testcase_08 AC 117 ms
40,700 KB
testcase_09 AC 111 ms
41,464 KB
testcase_10 AC 128 ms
41,668 KB
testcase_11 AC 124 ms
40,516 KB
testcase_12 AC 119 ms
42,084 KB
testcase_13 AC 131 ms
41,656 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		long N = scan.nextLong();
		scan.close();
		if(N == 1 || N == 2 || N == 3 || N == 4 || N == 5 || N == 7) {
			System.out.println(-1);
			System.exit(0);
		}
		if(Long.bitCount(N - 3) != 1) {
			long b = N - 3;
			System.out.println(3 + " " + b);
		}else if(Long.bitCount(N - 5) != 1) {
			long b = N - 5;
			System.out.println(5 + " " + b);
		}else {
			System.out.println(-1);
		}
	}
}
0