結果

問題 No.451 575
ユーザー fal_rndfal_rnd
提出日時 2016-12-02 00:29:01
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 567 bytes
コンパイル時間 1,960 ms
コンパイル使用メモリ 74,712 KB
実行使用メモリ 57,320 KB
最終ジャッジ日時 2024-05-09 17:00:18
合計ジャッジ時間 14,429 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 105 ms
41,156 KB
testcase_01 AC 95 ms
40,252 KB
testcase_02 AC 102 ms
40,840 KB
testcase_03 AC 92 ms
39,940 KB
testcase_04 AC 103 ms
40,860 KB
testcase_05 AC 169 ms
43,816 KB
testcase_06 AC 229 ms
47,424 KB
testcase_07 AC 609 ms
49,144 KB
testcase_08 AC 106 ms
40,996 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 1,073 ms
57,320 KB
testcase_14 AC 126 ms
41,160 KB
testcase_15 AC 158 ms
43,280 KB
testcase_16 AC 237 ms
47,156 KB
testcase_17 AC 648 ms
49,616 KB
testcase_18 AC 594 ms
48,920 KB
testcase_19 AC 514 ms
49,084 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 104 ms
40,816 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 106 ms
40,848 KB
testcase_26 AC 107 ms
41,172 KB
testcase_27 AC 132 ms
41,680 KB
testcase_28 AC 150 ms
42,204 KB
testcase_29 AC 208 ms
46,976 KB
testcase_30 AC 693 ms
49,112 KB
testcase_31 AC 103 ms
40,804 KB
testcase_32 AC 283 ms
48,368 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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]);
		}
	}
}
0