結果

問題 No.1198 お菓子配り-1
ユーザー ks2mks2m
提出日時 2020-08-28 21:34:45
言語 Java21
(openjdk 21)
結果
AC  
実行時間 112 ms / 2,000 ms
コード長 773 bytes
コンパイル時間 1,684 ms
コンパイル使用メモリ 74,424 KB
実行使用メモリ 41,304 KB
最終ジャッジ日時 2024-04-28 01:21:54
合計ジャッジ時間 4,233 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 104 ms
41,304 KB
testcase_01 AC 106 ms
41,080 KB
testcase_02 AC 98 ms
39,988 KB
testcase_03 AC 96 ms
40,228 KB
testcase_04 AC 98 ms
40,376 KB
testcase_05 AC 110 ms
41,124 KB
testcase_06 AC 112 ms
41,044 KB
testcase_07 AC 106 ms
41,204 KB
testcase_08 AC 110 ms
40,648 KB
testcase_09 AC 105 ms
40,188 KB
testcase_10 AC 109 ms
40,964 KB
testcase_11 AC 109 ms
41,180 KB
testcase_12 AC 108 ms
40,952 KB
testcase_13 AC 97 ms
40,048 KB
testcase_14 AC 105 ms
39,956 KB
testcase_15 AC 110 ms
40,644 KB
testcase_16 AC 96 ms
40,464 KB
testcase_17 AC 104 ms
41,100 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