結果
問題 |
No.505 カードの数式2
|
ユーザー |
|
提出日時 | 2017-05-09 16:24:06 |
言語 | Java (openjdk 23) |
結果 |
WA
|
実行時間 | - |
コード長 | 494 bytes |
コンパイル時間 | 2,269 ms |
コンパイル使用メモリ | 74,248 KB |
実行使用メモリ | 41,384 KB |
最終ジャッジ日時 | 2024-09-14 20:02:17 |
合計ジャッジ時間 | 7,226 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 11 WA * 18 |
ソースコード
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 = Math.abs(sc.nextInt()); num = Math.max(num + now, num * now); } System.out.println(num); } } }