結果

問題 No.804 野菜が苦手
ユーザー syu
提出日時 2020-08-30 20:28:11
言語 Java
(openjdk 23)
結果
AC  
実行時間 133 ms / 2,000 ms
コード長 585 bytes
コンパイル時間 2,298 ms
コンパイル使用メモリ 74,020 KB
実行使用メモリ 54,316 KB
最終ジャッジ日時 2024-11-15 15:15:52
合計ジャッジ時間 5,703 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

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=1+c;
        int vegetable=0;
        while(d>=unit){
            if(a>0 && b>=c){
                d-=unit;
                a--;
                b-=c;
                vegetable++;
            }else{
                break;
            }
        }
        System.out.println(vegetable);
        
        
        
    }
}
0