結果

問題 No.1198 お菓子配り-1
ユーザー ks2mks2m
提出日時 2020-08-28 21:34:45
言語 Java21
(openjdk 21)
結果
AC  
実行時間 125 ms / 2,000 ms
コード長 773 bytes
コンパイル時間 3,483 ms
コンパイル使用メモリ 73,752 KB
実行使用メモリ 56,484 KB
最終ジャッジ日時 2023-08-10 07:46:55
合計ジャッジ時間 6,763 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 120 ms
55,936 KB
testcase_01 AC 119 ms
55,592 KB
testcase_02 AC 118 ms
56,204 KB
testcase_03 AC 120 ms
55,968 KB
testcase_04 AC 119 ms
56,484 KB
testcase_05 AC 122 ms
56,160 KB
testcase_06 AC 123 ms
55,784 KB
testcase_07 AC 123 ms
55,908 KB
testcase_08 AC 124 ms
55,804 KB
testcase_09 AC 122 ms
56,224 KB
testcase_10 AC 120 ms
56,060 KB
testcase_11 AC 125 ms
56,016 KB
testcase_12 AC 118 ms
56,020 KB
testcase_13 AC 122 ms
55,636 KB
testcase_14 AC 122 ms
55,436 KB
testcase_15 AC 124 ms
56,332 KB
testcase_16 AC 122 ms
55,832 KB
testcase_17 AC 124 ms
56,088 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.math.BigInteger;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		BigInteger n = sc.nextBigInteger();
		sc.close();

		BigInteger b0 = BigInteger.ZERO;
		BigInteger b1 = BigInteger.ONE;
		BigInteger b2 = BigInteger.valueOf(2);
		BigInteger b3 = BigInteger.valueOf(3);
		BigInteger b4 = BigInteger.valueOf(4);
		BigInteger b8 = BigInteger.valueOf(8);
		if (n.remainder(b2).compareTo(b1) == 0) {
			if (n.compareTo(b3) >= 0) {
				System.out.println(1);
			} else {
				System.out.println(-1);
			}
		} else {
			if (n.remainder(b4).compareTo(b0) == 0 &&
					n.compareTo(b8) >= 0) {
				System.out.println(1);
			} else {
				System.out.println(-1);
			}
		}
	}
}
0