結果

問題 No.804 野菜が苦手
ユーザー ameame
提出日時 2019-03-22 21:30:39
言語 Java
(openjdk 23)
結果
AC  
実行時間 127 ms / 2,000 ms
コード長 596 bytes
コンパイル時間 2,632 ms
コンパイル使用メモリ 74,396 KB
実行使用メモリ 41,392 KB
最終ジャッジ日時 2024-09-19 02:51:33
合計ジャッジ時間 4,648 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

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 cnt = 0;
        while (true) {
            cnt++;
            if(cnt == a + 1){
                break;
            }
            if (cnt * c > b) {
                break;
            }
            if (cnt + cnt * c > d) {
                break;
            }
        }
        System.out.println(cnt - 1);
        sc.close();
    }
}
0