結果

問題 No.804 野菜が苦手
ユーザー ameame
提出日時 2019-03-22 21:30:39
言語 Java21
(openjdk 21)
結果
AC  
実行時間 142 ms / 2,000 ms
コード長 596 bytes
コンパイル時間 2,498 ms
コンパイル使用メモリ 73,972 KB
実行使用メモリ 57,740 KB
最終ジャッジ日時 2023-10-19 06:30:47
合計ジャッジ時間 6,188 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 133 ms
57,448 KB
testcase_01 AC 134 ms
57,608 KB
testcase_02 AC 134 ms
57,380 KB
testcase_03 AC 139 ms
57,556 KB
testcase_04 AC 142 ms
57,588 KB
testcase_05 AC 132 ms
57,552 KB
testcase_06 AC 135 ms
57,356 KB
testcase_07 AC 135 ms
57,476 KB
testcase_08 AC 139 ms
57,304 KB
testcase_09 AC 137 ms
57,688 KB
testcase_10 AC 136 ms
57,388 KB
testcase_11 AC 132 ms
55,316 KB
testcase_12 AC 134 ms
57,448 KB
testcase_13 AC 132 ms
57,544 KB
testcase_14 AC 137 ms
57,416 KB
testcase_15 AC 134 ms
57,452 KB
testcase_16 AC 133 ms
57,412 KB
testcase_17 AC 131 ms
55,644 KB
testcase_18 AC 132 ms
57,740 KB
testcase_19 AC 131 ms
57,640 KB
権限があれば一括ダウンロードができます

ソースコード

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