結果

問題 No.1298 OR XOR
ユーザー xRS43BofaUEZ5gcxRS43BofaUEZ5gc
提出日時 2021-03-08 10:34:54
言語 Java21
(openjdk 21)
結果
AC  
実行時間 175 ms / 2,000 ms
コード長 474 bytes
コンパイル時間 3,832 ms
コンパイル使用メモリ 76,224 KB
実行使用メモリ 42,892 KB
最終ジャッジ日時 2024-04-18 02:00:34
合計ジャッジ時間 7,095 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 165 ms
42,496 KB
testcase_01 AC 132 ms
41,244 KB
testcase_02 AC 135 ms
41,404 KB
testcase_03 AC 135 ms
41,688 KB
testcase_04 AC 136 ms
41,264 KB
testcase_05 AC 137 ms
41,240 KB
testcase_06 AC 170 ms
42,712 KB
testcase_07 AC 172 ms
42,484 KB
testcase_08 AC 173 ms
42,624 KB
testcase_09 AC 174 ms
42,616 KB
testcase_10 AC 173 ms
42,892 KB
testcase_11 AC 175 ms
42,616 KB
testcase_12 AC 173 ms
42,624 KB
testcase_13 AC 173 ms
42,472 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class HelloWorld {

	    public static void main(String[] args) throws Exception {

	    	Scanner sc = new Scanner(System.in);
	    	int n = sc.nextInt();
	    	if (n < 3) {
	    		System.out.println("-1 -1 -1");
	    	}

	    	int a = n;
	    	int b = -n & n;
	    	int c = n ^ b;

	    	if (a >0 && b > 0 && c >0) {
	    		System.out.println(a + " " + b + " " + c);
	    	}else {
	    	System.out.println("-1 -1 -1");}

	    	}

	    }


0