結果

問題 No.505 カードの数式2
ユーザー Goryudyuma
提出日時 2017-05-09 16:22:42
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 505 bytes
コンパイル時間 2,411 ms
コンパイル使用メモリ 74,652 KB
実行使用メモリ 55,984 KB
最終ジャッジ日時 2024-09-14 20:01:57
合計ジャッジ時間 8,213 ms
ジャッジサーバーID
(参考情報)
judge6 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 8 WA * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main{
        public static void main(String[] args){
                try(Scanner sc = new Scanner(System.in)){
                        int N = sc.nextInt(), num = 0, now;
                        for(int i = 0; i < N; i++){
                                now = sc.nextInt();
                                num = Math.max(num + now, Math.max(num - now, num * now));
                        }
                        System.out.println(num);
                }
        }
}
0