結果

問題 No.531 エヌスクミ島の平和協定
ユーザー Tsukasa_TypeTsukasa_Type
提出日時 2018-02-28 23:27:04
言語 Java21
(openjdk 21)
結果
AC  
実行時間 144 ms / 2,000 ms
コード長 533 bytes
コンパイル時間 2,205 ms
コンパイル使用メモリ 74,104 KB
実行使用メモリ 57,760 KB
最終ジャッジ日時 2023-10-19 22:35:39
合計ジャッジ時間 8,909 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 137 ms
57,568 KB
testcase_01 AC 139 ms
57,180 KB
testcase_02 AC 137 ms
57,424 KB
testcase_03 AC 137 ms
57,632 KB
testcase_04 AC 138 ms
57,160 KB
testcase_05 AC 140 ms
57,224 KB
testcase_06 AC 140 ms
57,204 KB
testcase_07 AC 135 ms
57,156 KB
testcase_08 AC 137 ms
57,568 KB
testcase_09 AC 140 ms
57,308 KB
testcase_10 AC 142 ms
57,624 KB
testcase_11 AC 138 ms
57,136 KB
testcase_12 AC 136 ms
57,200 KB
testcase_13 AC 138 ms
57,416 KB
testcase_14 AC 140 ms
57,188 KB
testcase_15 AC 136 ms
57,156 KB
testcase_16 AC 140 ms
57,196 KB
testcase_17 AC 136 ms
57,184 KB
testcase_18 AC 137 ms
57,532 KB
testcase_19 AC 141 ms
55,760 KB
testcase_20 AC 144 ms
57,224 KB
testcase_21 AC 141 ms
57,248 KB
testcase_22 AC 137 ms
57,140 KB
testcase_23 AC 136 ms
57,512 KB
testcase_24 AC 136 ms
57,472 KB
testcase_25 AC 139 ms
55,324 KB
testcase_26 AC 141 ms
57,460 KB
testcase_27 AC 139 ms
57,200 KB
testcase_28 AC 137 ms
57,604 KB
testcase_29 AC 135 ms
57,572 KB
testcase_30 AC 136 ms
57,204 KB
testcase_31 AC 137 ms
57,160 KB
testcase_32 AC 140 ms
57,692 KB
testcase_33 AC 142 ms
57,668 KB
testcase_34 AC 141 ms
57,760 KB
testcase_35 AC 144 ms
57,220 KB
testcase_36 AC 140 ms
57,536 KB
testcase_37 AC 140 ms
57,460 KB
testcase_38 AC 140 ms
57,720 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import static java.lang.System.*;

public class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		int n = sc.nextInt();
		int m = sc.nextInt();
		if (n <= m) {out.println(1);}
		else if (m == 2) {
			if (n == 2) {
				out.println(1);
			}
			else if (n == 4) {
				out.println(2);
			}
			else {
				out.println(-1);
			}
		}
		else {
			if (n%2==1) {out.println(-1);}
			else if (n%2==0) {
				if (n/2 > m) {out.println(-1);}
				else {out.println(2);}
			}
		}
	}
}
0