結果

問題 No.638 Sum of "not power of 2"
ユーザー YamaKasaYamaKasa
提出日時 2018-09-30 17:13:43
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 509 bytes
コンパイル時間 2,039 ms
コンパイル使用メモリ 76,856 KB
実行使用メモリ 54,376 KB
最終ジャッジ日時 2024-04-20 13:42:27
合計ジャッジ時間 4,499 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 111 ms
41,616 KB
testcase_01 AC 124 ms
41,736 KB
testcase_02 WA -
testcase_03 AC 118 ms
41,436 KB
testcase_04 AC 128 ms
40,160 KB
testcase_05 AC 116 ms
41,548 KB
testcase_06 AC 130 ms
41,544 KB
testcase_07 AC 127 ms
40,420 KB
testcase_08 AC 123 ms
40,224 KB
testcase_09 AC 114 ms
41,780 KB
testcase_10 AC 123 ms
41,648 KB
testcase_11 AC 124 ms
40,608 KB
testcase_12 AC 112 ms
41,608 KB
testcase_13 AC 120 ms
41,516 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