結果

問題 No.2056 非力なレッド
ユーザー tentententen
提出日時 2024-04-30 13:17:57
言語 Java21
(openjdk 21)
結果
AC  
実行時間 255 ms / 2,000 ms
コード長 1,666 bytes
コンパイル時間 2,209 ms
コンパイル使用メモリ 78,380 KB
実行使用メモリ 60,900 KB
最終ジャッジ日時 2024-04-30 13:18:12
合計ジャッジ時間 10,652 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 46 ms
50,392 KB
testcase_01 AC 46 ms
49,908 KB
testcase_02 AC 46 ms
50,392 KB
testcase_03 AC 46 ms
50,416 KB
testcase_04 AC 46 ms
50,172 KB
testcase_05 AC 45 ms
50,028 KB
testcase_06 AC 45 ms
50,376 KB
testcase_07 AC 45 ms
50,372 KB
testcase_08 AC 45 ms
50,368 KB
testcase_09 AC 46 ms
50,308 KB
testcase_10 AC 46 ms
50,136 KB
testcase_11 AC 47 ms
50,320 KB
testcase_12 AC 48 ms
50,244 KB
testcase_13 AC 240 ms
57,568 KB
testcase_14 AC 224 ms
57,732 KB
testcase_15 AC 201 ms
57,604 KB
testcase_16 AC 107 ms
52,184 KB
testcase_17 AC 177 ms
55,280 KB
testcase_18 AC 91 ms
52,008 KB
testcase_19 AC 113 ms
52,352 KB
testcase_20 AC 213 ms
57,456 KB
testcase_21 AC 141 ms
55,648 KB
testcase_22 AC 208 ms
57,528 KB
testcase_23 AC 202 ms
56,316 KB
testcase_24 AC 171 ms
56,004 KB
testcase_25 AC 223 ms
57,812 KB
testcase_26 AC 240 ms
58,552 KB
testcase_27 AC 227 ms
58,840 KB
testcase_28 AC 237 ms
60,876 KB
testcase_29 AC 242 ms
60,900 KB
testcase_30 AC 249 ms
60,764 KB
testcase_31 AC 245 ms
60,868 KB
testcase_32 AC 234 ms
60,736 KB
testcase_33 AC 255 ms
60,812 KB
testcase_34 AC 245 ms
60,252 KB
testcase_35 AC 246 ms
60,744 KB
testcase_36 AC 235 ms
60,696 KB
testcase_37 AC 252 ms
60,700 KB
testcase_38 AC 47 ms
50,328 KB
testcase_39 AC 46 ms
49,876 KB
testcase_40 AC 46 ms
50,304 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;
import java.util.function.*;
import java.util.stream.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner();
        int n = sc.nextInt();
        int strength = sc.nextInt();
        int magic = sc.nextInt();
        int[] values = new int[n];
        for (int i = 0; i < n; i++) {
            values[i] = sc.nextInt();
        }
        int count = 0;
        for (int i = n - 1; i >= 0; i--) {
            for (int j = 0; j < count; j++) {
                values[i] /= 2;
            }
            while (strength <= values[i]) {
                magic -= i + 1;
                values[i] /= 2;
                count++;
            }
        }
        System.out.println(magic >= 0 ? "Yes" : "No");
    }
}
class Scanner {
    BufferedReader br;
    StringTokenizer st = new StringTokenizer("");
    StringBuilder sb = new StringBuilder();
    
    public Scanner() {
        try {
            br = new BufferedReader(new InputStreamReader(System.in));
        } catch (Exception e) {
            
        }
    }
    
    public int nextInt() {
        return Integer.parseInt(next());
    }
    
    public long nextLong() {
        return Long.parseLong(next());
    }
    
    public double nextDouble() {
        return Double.parseDouble(next());
    }
    
    public String next() {
        try {
            while (!st.hasMoreTokens()) {
                st = new StringTokenizer(br.readLine());
            }
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            return st.nextToken();
        }
    }
    
}
0