結果
問題 | No.451 575 |
ユーザー |
![]() |
提出日時 | 2016-12-02 00:29:01 |
言語 | Java (openjdk 23) |
結果 |
WA
|
実行時間 | - |
コード長 | 567 bytes |
コンパイル時間 | 2,699 ms |
コンパイル使用メモリ | 74,528 KB |
実行使用メモリ | 56,252 KB |
最終ジャッジ日時 | 2024-12-16 07:43:17 |
合計ジャッジ時間 | 17,961 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 21 WA * 8 |
ソースコード
package src; import java.util.*; class B{ static Scanner s = new Scanner(System.in); public static void main(String[] args) { long[] out = new long[s.nextInt()+1]; out[0]=1; for(int i=0;i<out.length-1;++i) { if(i%2==0) { out[i+1]=Long.parseLong(s.next())-out[i]; }else { out[i+1]=out[i]-Long.parseLong(s.next()); } } boolean f=false; for(int i=0;i<out.length;i++) f|=(out[i]<=0); if(f) System.out.println(-1); else { System.out.println(out.length); for(int i=0;i<out.length;i++) System.out.println(out[i]); } } }