結果

問題 No.40 多項式の割り算
ユーザー rullonzrullonz
提出日時 2017-10-27 19:19:32
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 3 ms / 5,000 ms
コード長 1,772 bytes
コンパイル時間 1,605 ms
コンパイル使用メモリ 167,476 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-05-01 16:12:07
合計ジャッジ時間 2,540 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

struct edge {int /*from**/to,cost;};
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> VI;
typedef vector<long long int> VL;
typedef vector<edge> VE;
//static const int INF = 2147483647;
//static const long long INf = 9223372000000000000;
//static const long long INF = 9223372000000000000/2;
static const int INF = 1000010000;
static const int NIL = -1;
static const int MOD = 1000000007;
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define np next_permutation
#define pq priority_queue
#define itn int
#define scnaf scanf
#define reutnr return
#define scamf scanf
//int dx4[4] = {0,1,0,-1}, dy4[4] = {-1,0,1,0};
//int dx5[5] = {-1,0,0,0,1}, dy5[5] = {0,-1,0,1,0};
//int dx8[8] = {-1,0,1,1,1,0,-1,-1}, dy8[8] = {1,1,1,0,-1,-1,-1,0};
//int dx9[9] = {-1,0,1,1,1,0,-1,-1,0}, dy9[9] = {1,1,1,0,-1,-1,-1,0,0};
//#define int ll

int a[11451];
int D;

void nya_n(){
    printf("%d\n",D);
    for(int i=0;i<=D;i++){
        int tmp;
        scanf("%d",&tmp);
        printf("%d ",tmp);
    }
    printf("\n");
}
 
signed main(){
    scanf("%d",&D);
    if(D<3){
        nya_n();
        return 0;
    }
    int rull = 0,onz = 0;
    for(int i=0;i<=D;i++){
        scanf("%d",&a[i]);
        if(i%2==0) rull+=a[i],onz+=a[i];
        else rull+=a[i],onz-=a[i];
    }
    int rullonz[3];
    rullonz[0] = a[0];
    rull -= a[0],onz -= a[0];
    rullonz[2] = (rull+onz)/2;
    rullonz[1] = rull-rullonz[2];
    int digit=2;
    if(rullonz[2]==0) digit--;
    if(rullonz[1]==0) digit--;
    printf("%d\n",digit);
    for(int i=0;i<=digit;i++){
        printf("%d",rullonz[i]);
        if(i!=digit) printf(" ");
    }
    printf("\n");
    return 0;
}
0