結果

問題 No.638 Sum of "not power of 2"
ユーザー kitakitalilykitakitalily
提出日時 2019-04-05 23:21:52
言語 Java21
(openjdk 21)
結果
AC  
実行時間 144 ms / 1,000 ms
コード長 518 bytes
コンパイル時間 2,341 ms
コンパイル使用メモリ 73,644 KB
実行使用メモリ 56,060 KB
最終ジャッジ日時 2023-09-05 05:14:53
合計ジャッジ時間 5,008 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 126 ms
55,236 KB
testcase_01 AC 125 ms
55,588 KB
testcase_02 AC 126 ms
55,240 KB
testcase_03 AC 127 ms
55,576 KB
testcase_04 AC 143 ms
55,644 KB
testcase_05 AC 126 ms
55,356 KB
testcase_06 AC 142 ms
55,648 KB
testcase_07 AC 143 ms
55,820 KB
testcase_08 AC 143 ms
56,060 KB
testcase_09 AC 141 ms
55,732 KB
testcase_10 AC 142 ms
55,624 KB
testcase_11 AC 144 ms
53,608 KB
testcase_12 AC 128 ms
55,476 KB
testcase_13 AC 140 ms
55,944 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