結果

問題 No.804 野菜が苦手
ユーザー practikovatpractikovat
提出日時 2019-05-22 15:36:21
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 857 bytes
コンパイル時間 4,055 ms
コンパイル使用メモリ 74,640 KB
実行使用メモリ 57,628 KB
最終ジャッジ日時 2023-10-17 11:15:01
合計ジャッジ時間 7,745 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 132 ms
57,500 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 134 ms
57,508 KB
testcase_06 AC 133 ms
57,540 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 133 ms
57,504 KB
testcase_15 AC 131 ms
57,580 KB
testcase_16 AC 133 ms
57,492 KB
testcase_17 AC 133 ms
57,404 KB
testcase_18 AC 131 ms
57,496 KB
testcase_19 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class DislikeVegetables {
	public static void main(String args[]) {
		Scanner scan = new Scanner(System.in);
		// Vegetable の個数
		int a = scan.nextInt();
		// Meat の個数
		int b = scan.nextInt();
		// 一つVegetable を消費するのに必要な倍数
		int c = scan.nextInt();
		// 消費できるMaxの量
		int d = scan.nextInt();

		// 終了条件
		// 消費できる量はまだあるが、Vegetableがもうない
		// 消費できる量はまだあるが、Meatがもうない
		// Vegetable、Meatはまだあるが、消費できるMaxを超えている

		for(int i = a; i < 0; i--) {
			// 仮の消費量
			int eatNum = i * c;

			// 消費量が、BよりもDよりも少ない
			if((eatNum <= b) && (eatNum <= d)) {
				System.out.println(i);
			}
		}

		System.out.println(0);
		return;
	}
}
0