結果

問題 No.804 野菜が苦手
ユーザー キョウチクキョウチク
提出日時 2022-06-01 10:37:49
言語 Java21
(openjdk 21)
結果
AC  
実行時間 165 ms / 2,000 ms
コード長 601 bytes
コンパイル時間 4,138 ms
コンパイル使用メモリ 76,592 KB
実行使用メモリ 58,604 KB
最終ジャッジ日時 2023-10-21 00:46:57
合計ジャッジ時間 8,270 ms
ジャッジサーバーID
(参考情報)
judge10 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 159 ms
58,204 KB
testcase_01 AC 160 ms
58,344 KB
testcase_02 AC 159 ms
58,352 KB
testcase_03 AC 161 ms
58,400 KB
testcase_04 AC 159 ms
58,372 KB
testcase_05 AC 163 ms
58,216 KB
testcase_06 AC 161 ms
58,232 KB
testcase_07 AC 164 ms
58,328 KB
testcase_08 AC 162 ms
58,600 KB
testcase_09 AC 164 ms
56,564 KB
testcase_10 AC 162 ms
58,592 KB
testcase_11 AC 161 ms
58,180 KB
testcase_12 AC 163 ms
58,372 KB
testcase_13 AC 163 ms
58,352 KB
testcase_14 AC 165 ms
58,388 KB
testcase_15 AC 161 ms
58,580 KB
testcase_16 AC 162 ms
58,604 KB
testcase_17 AC 161 ms
58,328 KB
testcase_18 AC 164 ms
58,356 KB
testcase_19 AC 163 ms
56,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
public class Test12 {
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    String[] line;
    String regex=" ",result="";
    line=sc.nextLine().split(regex);
    int vege=Integer.parseInt(line[0]);
    int meat=Integer.parseInt(line[1]);
    int require=Integer.parseInt(line[2]);
    int capa=Integer.parseInt(line[3]);
    int eaten=0;
    while(true){
      meat-=require;
      vege-=1;
      capa-=require+1;
      if(meat<0||vege<0||capa<0) break;
      eaten++;
    }
    result+=eaten;
    System.out.println(result);
    sc.close();
  }
}
0