結果

問題 No.531 エヌスクミ島の平和協定
ユーザー Amanita2016
提出日時 2017-06-27 21:11:30
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 643 bytes
コンパイル時間 4,066 ms
コンパイル使用メモリ 74,268 KB
実行使用メモリ 55,664 KB
最終ジャッジ日時 2024-10-05 12:18:46
合計ジャッジ時間 8,248 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 11 WA * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

package yukicoder;

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		@SuppressWarnings("resource")
		Scanner sc =  new Scanner(System.in);
		String moment = sc.nextLine();
		String[] spl = moment.split(" ");
		int animal = Integer.parseInt(spl[0]);
		int boat = Integer.parseInt(spl[1]);
		if(animal < 3 || boat < 3){
			System.out.println(-1);
			return;
		}
		int numDay = -1;
		for(int i = boat ; i > 2 ; i--){
			if((animal % i) != 2){
				numDay = animal / i;
				if((animal % i) != 0){
					numDay++;
				}
				break;
			}
		}
		System.out.println(numDay);
	}

}
0