結果

問題 No.804 野菜が苦手
ユーザー eagle
提出日時 2022-06-16 14:19:53
言語 Java
(openjdk 23)
結果
AC  
実行時間 135 ms / 2,000 ms
コード長 544 bytes
コンパイル時間 1,808 ms
コンパイル使用メモリ 74,224 KB
実行使用メモリ 54,092 KB
最終ジャッジ日時 2024-10-06 12:06:05
合計ジャッジ時間 5,235 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

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