結果

問題 No.40 多項式の割り算
ユーザー kou6839kou6839
提出日時 2014-11-18 23:10:17
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 747 bytes
コンパイル時間 3,768 ms
コンパイル使用メモリ 76,060 KB
実行使用メモリ 61,788 KB
最終ジャッジ日時 2023-08-30 21:01:24
合計ジャッジ時間 13,575 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 165 ms
56,816 KB
testcase_02 AC 123 ms
55,684 KB
testcase_03 AC 149 ms
56,712 KB
testcase_04 AC 265 ms
61,176 KB
testcase_05 AC 270 ms
61,304 KB
testcase_06 AC 286 ms
61,740 KB
testcase_07 AC 284 ms
61,788 KB
testcase_08 AC 182 ms
57,256 KB
testcase_09 AC 266 ms
61,484 KB
testcase_10 AC 284 ms
59,856 KB
testcase_11 AC 258 ms
61,588 KB
testcase_12 AC 246 ms
60,264 KB
testcase_13 AC 279 ms
61,672 KB
testcase_14 AC 262 ms
61,164 KB
testcase_15 AC 258 ms
61,292 KB
testcase_16 AC 283 ms
61,472 KB
testcase_17 AC 242 ms
59,912 KB
testcase_18 AC 282 ms
61,552 KB
testcase_19 AC 286 ms
59,312 KB
testcase_20 AC 252 ms
60,248 KB
testcase_21 AC 233 ms
60,760 KB
testcase_22 AC 235 ms
60,384 KB
testcase_23 AC 259 ms
60,696 KB
testcase_24 AC 272 ms
61,220 KB
testcase_25 AC 162 ms
56,648 KB
testcase_26 AC 163 ms
57,048 KB
testcase_27 AC 163 ms
56,648 KB
testcase_28 WA -
testcase_29 AC 164 ms
56,884 KB
testcase_30 AC 162 ms
56,808 KB
testcase_31 AC 164 ms
57,080 KB
testcase_32 WA -
testcase_33 AC 161 ms
56,680 KB
testcase_34 AC 159 ms
56,584 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
 

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] aa = new int[n+1];
		for(int i=n;i>=0;i--){
			aa[i]=sc.nextInt();
		}
		if(n<3){
			String g="";
			for(int i=n;i>=0;i--){
				g+=aa[i]+" ";
			}
			System.out.println(g.trim());
			return;
		}
		for(int i=0;i<=n-3;i++){
			int temp=aa[i];
			aa[i]=0;
			aa[i+2]-=-1*temp;
		}
		if(aa[n-2]!=0){
			System.out.println(2);
			System.out.println(aa[n]+" "+aa[n-1]+" "+aa[n-2]);
			return;
		}else if(aa[n-1]!=0){
			System.out.println(1);
			System.out.println(aa[n]+" "+aa[n-1]);
		}else{
			System.out.println(0);
			System.out.println(aa[n]);
		}
	}
}	
0