結果
| 問題 | No.40 多項式の割り算 | 
| コンテスト | |
| ユーザー |  alpha_virginis | 
| 提出日時 | 2015-03-25 23:43:54 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 4 ms / 5,000 ms | 
| コード長 | 903 bytes | 
| コンパイル時間 | 1,239 ms | 
| コンパイル使用メモリ | 63,568 KB | 
| 実行使用メモリ | 6,944 KB | 
| 最終ジャッジ日時 | 2024-06-29 00:58:15 | 
| 合計ジャッジ時間 | 1,627 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 32 | 
ソースコード
#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;
  
}
            
            
            
        