結果

問題 No.804 野菜が苦手
ユーザー eagleeagle
提出日時 2022-06-16 14:19:53
言語 Java21
(openjdk 21)
結果
AC  
実行時間 145 ms / 2,000 ms
コード長 544 bytes
コンパイル時間 2,308 ms
コンパイル使用メモリ 74,240 KB
実行使用メモリ 54,440 KB
最終ジャッジ日時 2024-04-16 02:12:53
合計ジャッジ時間 6,093 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 139 ms
54,440 KB
testcase_01 AC 140 ms
54,068 KB
testcase_02 AC 138 ms
54,064 KB
testcase_03 AC 140 ms
54,208 KB
testcase_04 AC 137 ms
54,148 KB
testcase_05 AC 145 ms
54,368 KB
testcase_06 AC 141 ms
53,892 KB
testcase_07 AC 139 ms
54,080 KB
testcase_08 AC 139 ms
54,240 KB
testcase_09 AC 138 ms
54,148 KB
testcase_10 AC 138 ms
53,804 KB
testcase_11 AC 140 ms
53,952 KB
testcase_12 AC 138 ms
54,092 KB
testcase_13 AC 139 ms
54,136 KB
testcase_14 AC 140 ms
54,384 KB
testcase_15 AC 138 ms
54,072 KB
testcase_16 AC 140 ms
54,308 KB
testcase_17 AC 138 ms
54,184 KB
testcase_18 AC 144 ms
54,132 KB
testcase_19 AC 142 ms
53,984 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		//野菜の数
		int A = sc.nextInt();
		//肉の数
		int B = sc.nextInt();
		//食べる肉の倍数
		int C = sc.nextInt();
		//一日の食べれる量
		int D = sc.nextInt();
		int ans = 0;
		for(int i = A; i > 0; i--) {
			if(B >= i * C) {
				int eat = i + i * C;
				if(D >= eat) {
					ans = i;
					break;
				}
			}
		}
		System.out.println(ans);
	}
}
0