結果

問題 No.1736 Princess vs. Dragoness
ユーザー lotokalotoka
提出日時 2021-12-22 21:45:21
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 1,132 bytes
コンパイル時間 2,323 ms
コンパイル使用メモリ 77,692 KB
実行使用メモリ 58,996 KB
最終ジャッジ日時 2024-09-16 16:59:52
合計ジャッジ時間 10,335 ms
ジャッジサーバーID
(参考情報)
judge6 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 16 WA * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

class Main{
    public static void main(String[] args){
        Scanner scn = new Scanner(System.in);
        
        int N = scn.nextInt();
        int A = scn.nextInt();
        int B = scn.nextInt();
        int X = scn.nextInt();
        int Y = scn.nextInt();
        int[] H = new int[N];
        
        int mostNum = 0;
        int mostTime = 0;
        
        int sum = 0;
        
        for(int i = 0; i < N; i++){
            H[i] = scn.nextInt();
        }
        
        for(int i = 0; i < A; i++){
            
            mostNum = 0;
            
            for(int j = 0; j < N; j++){
                if(mostNum < H[j]){
                    mostNum = H[j];
                    mostTime = j;
                }
            }
            
            H[mostTime] -= X;
        }
        
        for(int i = 0; i < N; i++){
            if(H[i] < 0){
                H[i] = 0;
            }
            
            sum += H[i];
        }
        
        if(sum <= B * Y){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
}
0