結果

問題 No.804 野菜が苦手
ユーザー syu
提出日時 2020-08-30 19:55:39
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 620 bytes
コンパイル時間 2,143 ms
コンパイル使用メモリ 74,136 KB
実行使用メモリ 54,432 KB
最終ジャッジ日時 2024-11-15 15:14:59
合計ジャッジ時間 4,974 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 8 WA * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        int a=sc.nextInt();
        int b=sc.nextInt();
        int c=sc.nextInt();
        int d=sc.nextInt();
        
        int unit=a+c;
        int vegetable=0;
        int totalEat=0;
        while(d>=totalEat){
            if(a>0 && b>=c){
                totalEat+=unit;
                a--;
                b-=c;
                vegetable++;
            }else{
                break;
            }
        }
        System.out.println(vegetable);
        
        
        
    }
}
0