結果
問題 | No.531 エヌスクミ島の平和協定 |
ユーザー |
![]() |
提出日時 | 2018-02-28 23:27:04 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 125 ms / 2,000 ms |
コード長 | 533 bytes |
コンパイル時間 | 3,326 ms |
コンパイル使用メモリ | 73,832 KB |
実行使用メモリ | 41,476 KB |
最終ジャッジ日時 | 2024-09-19 18:35:15 |
合計ジャッジ時間 | 7,631 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 37 |
ソースコード
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);}}}}}