結果

問題 No.40 多項式の割り算
ユーザー alpha_virginisalpha_virginis
提出日時 2015-03-25 23:43:54
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 4 ms / 5,000 ms
コード長 903 bytes
コンパイル時間 517 ms
コンパイル使用メモリ 63,544 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-11 10:16:34
合計ジャッジ時間 1,918 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 3 ms
4,380 KB
testcase_05 AC 3 ms
4,376 KB
testcase_06 AC 3 ms
4,376 KB
testcase_07 AC 3 ms
4,380 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 3 ms
4,376 KB
testcase_10 AC 4 ms
4,376 KB
testcase_11 AC 3 ms
4,376 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 3 ms
4,380 KB
testcase_14 AC 3 ms
4,376 KB
testcase_15 AC 3 ms
4,380 KB
testcase_16 AC 3 ms
4,380 KB
testcase_17 AC 2 ms
4,376 KB
testcase_18 AC 3 ms
4,380 KB
testcase_19 AC 3 ms
4,376 KB
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 2 ms
4,380 KB
testcase_22 AC 2 ms
4,380 KB
testcase_23 AC 2 ms
4,380 KB
testcase_24 AC 3 ms
4,376 KB
testcase_25 AC 2 ms
4,380 KB
testcase_26 AC 1 ms
4,380 KB
testcase_27 AC 2 ms
4,376 KB
testcase_28 AC 2 ms
4,376 KB
testcase_29 AC 1 ms
4,376 KB
testcase_30 AC 1 ms
4,380 KB
testcase_31 AC 2 ms
4,380 KB
testcase_32 AC 1 ms
4,376 KB
testcase_33 AC 2 ms
4,376 KB
testcase_34 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <vector>

int main() {

  long i, j, k;
  long ans[3];
  long count = 0;
  std::string str;
  std::vector<long> v;
  long temp;
  
  long D;

  std::cin >> D;

  for(i = 0; i < D+1; i++) {
    std::cin >> temp;
    v.push_back(temp);
  }

  ans[0] = v[0];
  ans[1] = 0;
  for(i = 1; i < D+1; i+=2) {
    ans[1] += v[i];
  }
  ans[2] = 0;
  for(i = 2; i < D+1; i+=2) {
    ans[2] += v[i];
  }

  if(ans[2] != 0) {
    std::cout << 2 << std::endl;
    std::cout << ans[0] << " " << ans[1] << " " << ans[2] << std::endl;
    return 0;
  }

  if(ans[1] != 0) {
    std::cout << 1 << std::endl;
    std::cout << ans[0] << " " << ans[1] << std::endl;
    return 0;
  }

  if(ans[0] != 0) {
    std::cout << 0 << std::endl;
    std::cout << ans[0] << std::endl;
    return 0;
  }

  std::cout << 0 << std::endl;
  std::cout << 0 << std::endl;
  return 0;
  
}
0