結果

問題 No.40 多項式の割り算
ユーザー holegumaholeguma
提出日時 2015-08-11 02:11:27
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 894 bytes
コンパイル時間 2,080 ms
コンパイル使用メモリ 75,224 KB
実行使用メモリ 57,732 KB
最終ジャッジ日時 2023-09-25 08:03:51
合計ジャッジ時間 8,194 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 115 ms
55,664 KB
testcase_02 AC 42 ms
49,496 KB
testcase_03 AC 115 ms
55,412 KB
testcase_04 AC 141 ms
56,060 KB
testcase_05 AC 148 ms
55,916 KB
testcase_06 AC 151 ms
56,392 KB
testcase_07 AC 155 ms
56,312 KB
testcase_08 AC 117 ms
55,840 KB
testcase_09 AC 147 ms
55,632 KB
testcase_10 AC 146 ms
55,540 KB
testcase_11 AC 136 ms
55,824 KB
testcase_12 AC 131 ms
55,720 KB
testcase_13 AC 152 ms
56,580 KB
testcase_14 AC 139 ms
55,556 KB
testcase_15 AC 139 ms
53,968 KB
testcase_16 AC 150 ms
55,864 KB
testcase_17 AC 125 ms
55,872 KB
testcase_18 AC 149 ms
55,916 KB
testcase_19 AC 157 ms
55,960 KB
testcase_20 AC 133 ms
55,456 KB
testcase_21 AC 124 ms
53,644 KB
testcase_22 AC 123 ms
55,648 KB
testcase_23 AC 136 ms
53,876 KB
testcase_24 AC 148 ms
55,980 KB
testcase_25 AC 113 ms
55,704 KB
testcase_26 AC 112 ms
55,784 KB
testcase_27 AC 114 ms
55,476 KB
testcase_28 WA -
testcase_29 AC 114 ms
55,760 KB
testcase_30 AC 113 ms
55,820 KB
testcase_31 AC 117 ms
56,056 KB
testcase_32 WA -
testcase_33 AC 116 ms
55,932 KB
testcase_34 AC 116 ms
56,092 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||d==1||d==2){
out.println(d);
if(d==0) out.println(a[0]);
if(d==1) out.printf("%d %d\r\n",a[0],a[1]);
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