結果
問題 | No.2693 Sword |
ユーザー |
![]() |
提出日時 | 2024-03-26 14:53:19 |
言語 | Java (openjdk 23) |
結果 |
RE
|
実行時間 | - |
コード長 | 1,250 bytes |
コンパイル時間 | 3,491 ms |
コンパイル使用メモリ | 77,960 KB |
実行使用メモリ | 48,028 KB |
最終ジャッジ日時 | 2024-09-30 14:17:06 |
合計ジャッジ時間 | 8,161 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 RE * 1 |
other | AC * 6 WA * 5 RE * 18 |
ソースコード
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);}}