結果
問題 |
No.505 カードの数式2
|
ユーザー |
![]() |
提出日時 | 2017-04-21 23:13:31 |
言語 | Java (openjdk 23) |
結果 |
WA
|
実行時間 | - |
コード長 | 552 bytes |
コンパイル時間 | 5,725 ms |
コンパイル使用メモリ | 74,128 KB |
実行使用メモリ | 56,168 KB |
最終ジャッジ日時 | 2024-07-20 17:40:00 |
合計ジャッジ時間 | 10,971 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 11 WA * 18 |
ソースコード
package javacode; import java.util.Scanner; public class yukicoder2 { public static void main(String args[]){ Scanner cin = new Scanner(System.in); int target = cin.nextInt(); long tmp[] =new long[target]; long result=0; for(int i=0;i<target;i++){ tmp[i] = Math.abs(cin.nextLong()); } for(int k=0;k<target;k++){ if(result ==0L && tmp[k]>0L){ result = tmp[k]; }else if(tmp[k]==0L){ }else{ if(tmp[k]==1L){ result += tmp[k]; }else{ result *= tmp[k]; } } } System.out.println(result); } }