結果

問題 No.2693 Sword
ユーザー fujitafujita
提出日時 2024-03-26 14:53:19
言語 Java21
(openjdk 21)
結果
RE  
実行時間 -
コード長 1,250 bytes
コンパイル時間 3,856 ms
コンパイル使用メモリ 77,520 KB
実行使用メモリ 63,164 KB
最終ジャッジ日時 2024-03-26 14:53:34
合計ジャッジ時間 10,937 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 132 ms
57,696 KB
testcase_01 AC 134 ms
57,816 KB
testcase_02 AC 129 ms
57,576 KB
testcase_03 RE -
testcase_04 AC 132 ms
57,544 KB
testcase_05 AC 129 ms
57,712 KB
testcase_06 AC 129 ms
55,560 KB
testcase_07 AC 132 ms
57,840 KB
testcase_08 AC 133 ms
57,828 KB
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 AC 134 ms
57,816 KB
testcase_32 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class App {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        String[] temp = sc.nextLine().split(" ");
        int N = Integer.parseInt(temp[0]);//アイテムの個数
        int P = Integer.parseInt(temp[1]);//剣の攻撃力
        int K = Integer.parseInt(temp[2]);//装備するアイテム
        int T , B , _Max_Power = 0;
        String[] _attack_power = new String[N];
        for(int i = 0; i < N; i++){
            _attack_power[i] = sc.nextLine();
        }
        for(int i = 0; i <= N - K; i++){
            int _attack_power_count = P;
            for(int j = 0 + i; j < K + i; j++){
                String[] item_type =  _attack_power[j].split(" ");
                T = Integer.parseInt(item_type[0]);
                B = Integer.parseInt(item_type[1]);
                if(T == 1){
                    _attack_power_count += B;
                }
                else if(T == 2){
                    _attack_power_count = _attack_power_count * 2;
                }
            }
            if(_attack_power_count > _Max_Power){
                _Max_Power = _attack_power_count;
            }  
        }
        System.out.println(_Max_Power);
    }
}
0