結果

問題 No.638 Sum of "not power of 2"
ユーザー YamaKasaYamaKasa
提出日時 2018-09-30 17:13:43
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 509 bytes
コンパイル時間 4,514 ms
コンパイル使用メモリ 74,396 KB
実行使用メモリ 58,176 KB
最終ジャッジ日時 2023-08-02 13:39:14
合計ジャッジ時間 7,629 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 113 ms
55,372 KB
testcase_01 AC 113 ms
55,964 KB
testcase_02 WA -
testcase_03 AC 112 ms
56,088 KB
testcase_04 AC 128 ms
55,824 KB
testcase_05 AC 113 ms
55,424 KB
testcase_06 AC 128 ms
55,704 KB
testcase_07 AC 129 ms
55,712 KB
testcase_08 AC 128 ms
56,100 KB
testcase_09 AC 130 ms
56,248 KB
testcase_10 AC 131 ms
56,184 KB
testcase_11 AC 129 ms
56,120 KB
testcase_12 AC 114 ms
55,764 KB
testcase_13 AC 127 ms
56,260 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 == 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