結果

問題 No.40 多項式の割り算
ユーザー takeya_okinotakeya_okino
提出日時 2017-10-27 18:57:17
言語 Java21
(openjdk 21)
結果
AC  
実行時間 302 ms / 5,000 ms
コード長 731 bytes
コンパイル時間 3,918 ms
コンパイル使用メモリ 86,748 KB
実行使用メモリ 48,728 KB
最終ジャッジ日時 2024-05-01 16:11:33
合計ジャッジ時間 13,229 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 168 ms
42,332 KB
testcase_01 AC 152 ms
42,076 KB
testcase_02 AC 130 ms
41,484 KB
testcase_03 AC 156 ms
42,304 KB
testcase_04 AC 269 ms
47,864 KB
testcase_05 AC 285 ms
47,708 KB
testcase_06 AC 287 ms
48,728 KB
testcase_07 AC 287 ms
48,548 KB
testcase_08 AC 190 ms
43,088 KB
testcase_09 AC 274 ms
47,856 KB
testcase_10 AC 290 ms
48,300 KB
testcase_11 AC 269 ms
47,780 KB
testcase_12 AC 253 ms
46,676 KB
testcase_13 AC 287 ms
48,436 KB
testcase_14 AC 266 ms
48,120 KB
testcase_15 AC 275 ms
47,900 KB
testcase_16 AC 302 ms
48,676 KB
testcase_17 AC 246 ms
45,164 KB
testcase_18 AC 287 ms
48,324 KB
testcase_19 AC 291 ms
48,364 KB
testcase_20 AC 265 ms
47,172 KB
testcase_21 AC 239 ms
45,484 KB
testcase_22 AC 235 ms
43,664 KB
testcase_23 AC 264 ms
46,472 KB
testcase_24 AC 273 ms
48,304 KB
testcase_25 AC 163 ms
42,612 KB
testcase_26 AC 169 ms
42,732 KB
testcase_27 AC 169 ms
42,724 KB
testcase_28 AC 131 ms
41,052 KB
testcase_29 AC 165 ms
42,692 KB
testcase_30 AC 168 ms
42,816 KB
testcase_31 AC 151 ms
42,592 KB
testcase_32 AC 151 ms
42,420 KB
testcase_33 AC 171 ms
42,740 KB
testcase_34 AC 169 ms
42,580 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int d = sc.nextInt();
    int r0 = 0;
    int r1 = 0;
    int r2 = 0;
    for(int i = 0; i <= d; i++) {
      int a = sc.nextInt();
      if(i == 0) r0 = a;
      r1 += a;
      if(i % 2 == 0) {
        r2 += a;
      } else {
        r2 -= a;
      }
    }
    int c = r0;
    int a = (r1 + r2 - 2 * c) / 2;
    int b = r1 - a - c;
    if(a != 0) {
      System.out.println(2);
      System.out.println(c + " " + b + " " + a);
    } else if(b != 0) {
      System.out.println(1);
      System.out.println(c + " " + b);
    } else {
      System.out.println(0);
      System.out.println(c);
    }
  }
}
0