結果

問題 No.638 Sum of "not power of 2"
ユーザー GrenacheGrenache
提出日時 2018-02-12 12:31:19
言語 Java19
(openjdk 21)
結果
AC  
実行時間 130 ms / 1,000 ms
コード長 770 bytes
コンパイル時間 3,495 ms
コンパイル使用メモリ 73,520 KB
実行使用メモリ 56,428 KB
最終ジャッジ日時 2023-08-15 20:15:26
合計ジャッジ時間 6,432 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 124 ms
55,980 KB
testcase_01 AC 123 ms
55,944 KB
testcase_02 AC 124 ms
55,764 KB
testcase_03 AC 126 ms
55,860 KB
testcase_04 AC 125 ms
55,892 KB
testcase_05 AC 124 ms
56,252 KB
testcase_06 AC 130 ms
56,196 KB
testcase_07 AC 126 ms
56,224 KB
testcase_08 AC 128 ms
55,964 KB
testcase_09 AC 125 ms
56,152 KB
testcase_10 AC 125 ms
56,108 KB
testcase_11 AC 126 ms
56,204 KB
testcase_12 AC 127 ms
56,428 KB
testcase_13 AC 126 ms
56,016 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;


public class Main_yukicoder638 {

	private static Scanner sc;
	private static Printer pr;

	private static void solve() {
		long n = sc.nextLong();

		Set<Long> hs = new HashSet<>();
		for (int i = 0; i < 61; i++) {
			hs.add(1L << i);
		}

		for (long i = 3; i <= n - i; i++) {
			if (hs.contains(i) || hs.contains(n - i)) {
				continue;
			}

			pr.printf("%d %d\n", i, n - i);
			return;
		}

		pr.println(-1);
	}

	// ---------------------------------------------------
	public static void main(String[] args) {
		sc = new Scanner(System.in);
		pr = new Printer(System.out);

		solve();

		pr.close();
		sc.close();
	}

	private static class Printer extends PrintWriter {
		Printer(PrintStream out) {
			super(out);
		}
	}
}
0