結果

問題 No.40 多項式の割り算
ユーザー chiho_miyakochiho_miyako
提出日時 2015-04-07 15:25:01
言語 Java21
(openjdk 21)
結果
AC  
実行時間 292 ms / 5,000 ms
コード長 1,217 bytes
コンパイル時間 2,195 ms
コンパイル使用メモリ 76,204 KB
実行使用メモリ 62,476 KB
最終ジャッジ日時 2023-09-17 15:45:26
合計ジャッジ時間 11,365 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 124 ms
55,668 KB
testcase_01 AC 166 ms
56,848 KB
testcase_02 AC 125 ms
55,780 KB
testcase_03 AC 155 ms
56,832 KB
testcase_04 AC 269 ms
61,544 KB
testcase_05 AC 281 ms
61,764 KB
testcase_06 AC 292 ms
61,652 KB
testcase_07 AC 291 ms
62,232 KB
testcase_08 AC 188 ms
57,372 KB
testcase_09 AC 271 ms
60,916 KB
testcase_10 AC 282 ms
61,584 KB
testcase_11 AC 263 ms
60,596 KB
testcase_12 AC 254 ms
60,612 KB
testcase_13 AC 292 ms
61,596 KB
testcase_14 AC 270 ms
61,212 KB
testcase_15 AC 265 ms
60,436 KB
testcase_16 AC 284 ms
61,628 KB
testcase_17 AC 246 ms
60,412 KB
testcase_18 AC 282 ms
61,984 KB
testcase_19 AC 285 ms
61,296 KB
testcase_20 AC 258 ms
60,396 KB
testcase_21 AC 227 ms
59,800 KB
testcase_22 AC 239 ms
60,668 KB
testcase_23 AC 258 ms
62,476 KB
testcase_24 AC 272 ms
61,596 KB
testcase_25 AC 171 ms
56,544 KB
testcase_26 AC 165 ms
54,692 KB
testcase_27 AC 165 ms
56,852 KB
testcase_28 AC 125 ms
55,960 KB
testcase_29 AC 166 ms
56,984 KB
testcase_30 AC 166 ms
56,836 KB
testcase_31 AC 165 ms
56,924 KB
testcase_32 AC 124 ms
56,116 KB
testcase_33 AC 166 ms
57,168 KB
testcase_34 AC 164 ms
56,608 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner koko = new Scanner(System.in);
        int d = koko.nextInt();
        int[] a = new int[d+1];
        int gu = 0;
        int ki = 0;
        if(d<3){
            System.out.println(d);
            for(int i=0; i<d;i++){
                a[i] = koko.nextInt();
                System.out.print(a[i]);
                System.out.print(" ");
            }
            a[0]=koko.nextInt();
            System.out.println(a[0]);
        }else{
            a[0]=koko.nextInt();
            for(int i=1; i<d+1; i++){
                a[i] = koko.nextInt();
                if(i%2==0){
                    gu=gu+a[i];
                }else if(i%2!=0){
                    ki=ki+a[i];
                }
            }
            if(gu!=0){
                System.out.println(2);
                System.out.println(a[0]+" "+ki+" "+gu);
            }else if(gu==0&&ki!=0){
                System.out.println(1);
                System.out.println(a[0]+" "+ki);
            }else if(gu==0&&ki==0){
                System.out.println(0);
                System.out.println(a[0]);
            }
        }
    }
}
0