結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 112 ms
55,564 KB
testcase_01 AC 115 ms
55,836 KB
testcase_02 AC 43 ms
49,500 KB
testcase_03 AC 114 ms
55,728 KB
testcase_04 AC 139 ms
55,832 KB
testcase_05 AC 143 ms
55,656 KB
testcase_06 AC 151 ms
56,388 KB
testcase_07 AC 156 ms
56,608 KB
testcase_08 AC 114 ms
55,564 KB
testcase_09 AC 147 ms
56,076 KB
testcase_10 AC 154 ms
56,172 KB
testcase_11 AC 138 ms
55,612 KB
testcase_12 AC 126 ms
55,660 KB
testcase_13 AC 148 ms
55,852 KB
testcase_14 AC 146 ms
55,792 KB
testcase_15 AC 140 ms
55,504 KB
testcase_16 AC 152 ms
56,336 KB
testcase_17 AC 128 ms
55,876 KB
testcase_18 AC 150 ms
55,884 KB
testcase_19 AC 155 ms
56,416 KB
testcase_20 AC 132 ms
55,716 KB
testcase_21 AC 128 ms
55,592 KB
testcase_22 AC 123 ms
55,856 KB
testcase_23 AC 131 ms
55,392 KB
testcase_24 AC 148 ms
55,700 KB
testcase_25 AC 113 ms
55,640 KB
testcase_26 AC 113 ms
55,756 KB
testcase_27 AC 113 ms
55,316 KB
testcase_28 AC 46 ms
49,348 KB
testcase_29 AC 112 ms
55,624 KB
testcase_30 AC 114 ms
55,320 KB
testcase_31 AC 116 ms
55,628 KB
testcase_32 AC 114 ms
55,564 KB
testcase_33 AC 115 ms
55,972 KB
testcase_34 AC 119 ms
55,544 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]);
out.flush();
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