結果

問題 No.638 Sum of "not power of 2"
ユーザー Mcpu3Mcpu3
提出日時 2018-09-04 21:24:40
言語 Java21
(openjdk 21)
結果
AC  
実行時間 132 ms / 1,000 ms
コード長 368 bytes
コンパイル時間 1,956 ms
コンパイル使用メモリ 76,012 KB
実行使用メモリ 41,664 KB
最終ジャッジ日時 2024-04-23 19:14:58
合計ジャッジ時間 4,284 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 109 ms
41,268 KB
testcase_01 AC 102 ms
40,000 KB
testcase_02 AC 101 ms
40,376 KB
testcase_03 AC 106 ms
40,268 KB
testcase_04 AC 132 ms
41,664 KB
testcase_05 AC 100 ms
40,088 KB
testcase_06 AC 124 ms
41,304 KB
testcase_07 AC 116 ms
40,840 KB
testcase_08 AC 108 ms
40,264 KB
testcase_09 AC 111 ms
39,940 KB
testcase_10 AC 124 ms
41,212 KB
testcase_11 AC 121 ms
41,008 KB
testcase_12 AC 109 ms
40,904 KB
testcase_13 AC 127 ms
41,608 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

class Main{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		long n=sc.nextLong(),i;
		sc.close();
		if(n-3>2&&n!=7) {
			for(i=2;i<60;++i) if((long)Math.pow(2, i)==n-3) break;
			if(i==60) System.out.print("3 "+(n-3));
			else System.out.print("5 "+(n-5));
		}
		else System.out.print(-1);
	}
}
0