結果

問題 No.40 多項式の割り算
ユーザー holegumaholeguma
提出日時 2015-08-11 02:09:40
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 884 bytes
コンパイル時間 2,106 ms
コンパイル使用メモリ 74,284 KB
実行使用メモリ 56,456 KB
最終ジャッジ日時 2023-09-25 08:03:35
合計ジャッジ時間 7,959 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 114 ms
56,148 KB
testcase_02 AC 44 ms
49,356 KB
testcase_03 AC 115 ms
56,016 KB
testcase_04 AC 142 ms
55,988 KB
testcase_05 AC 147 ms
55,800 KB
testcase_06 AC 156 ms
56,356 KB
testcase_07 AC 156 ms
56,036 KB
testcase_08 AC 114 ms
55,704 KB
testcase_09 AC 145 ms
55,836 KB
testcase_10 AC 148 ms
55,852 KB
testcase_11 AC 140 ms
55,540 KB
testcase_12 AC 130 ms
55,612 KB
testcase_13 AC 153 ms
56,088 KB
testcase_14 AC 142 ms
55,640 KB
testcase_15 AC 142 ms
55,804 KB
testcase_16 AC 150 ms
55,752 KB
testcase_17 AC 131 ms
55,556 KB
testcase_18 AC 151 ms
55,876 KB
testcase_19 AC 155 ms
56,456 KB
testcase_20 AC 140 ms
55,768 KB
testcase_21 AC 127 ms
55,448 KB
testcase_22 AC 126 ms
55,564 KB
testcase_23 AC 133 ms
55,652 KB
testcase_24 AC 151 ms
55,668 KB
testcase_25 AC 114 ms
56,320 KB
testcase_26 AC 116 ms
55,592 KB
testcase_27 AC 114 ms
55,608 KB
testcase_28 WA -
testcase_29 AC 115 ms
55,788 KB
testcase_30 AC 116 ms
55,544 KB
testcase_31 AC 117 ms
55,764 KB
testcase_32 WA -
testcase_33 AC 115 ms
55,400 KB
testcase_34 AC 114 ms
55,656 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.StringTokenizer;

class Main{

static final PrintWriter out=new PrintWriter(System.out);

public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String line="";
while((line=br.readLine())!=null&&!line.isEmpty()){
int d=Integer.parseInt(line);
int[] a=new int[d+1];
StringTokenizer st=new StringTokenizer(br.readLine());
for(int i=0;i<=d;i++) a[i]=Integer.parseInt(st.nextToken());
if(d==0){
out.println(a[0]);
continue;
}
if(d==1) {
out.printf("%d %d\r\n",a[0],a[1]);
continue;
}
if(d==2){
out.printf("%d %d %d\r\n",a[0],a[1],a[2]);
continue;
}
for(int i=d;i>=3;i--) a[i-2]+=a[i];
int dd=a[2]==0?a[1]==0?0:1:2;
out.println(dd);
if(dd==0) out.println(a[0]);
if(dd==1) out.printf("%d %d\r\n",a[0],a[1]);
if(dd==2) out.printf("%d %d %d\r\n",a[0],a[1],a[2]);
out.flush();
}
}
}
0