結果

問題 No.265 数学のテスト
ユーザー BantakoBantako
提出日時 2018-05-31 00:15:00
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,330 bytes
コンパイル時間 2,763 ms
コンパイル使用メモリ 169,468 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-12 20:52:50
合計ジャッジ時間 4,132 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 2 ms
4,380 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 2 ms
4,380 KB
testcase_22 WA -
testcase_23 AC 1 ms
4,380 KB
testcase_24 AC 2 ms
4,380 KB
testcase_25 WA -
testcase_26 AC 2 ms
4,380 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 2 ms
4,380 KB
testcase_32 WA -
testcase_33 WA -
testcase_34 AC 1 ms
4,376 KB
testcase_35 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:32:1: 警告: ISO C++ では型の無い ‘main’ の宣言を禁止しています [-Wreturn-type]
   32 | main(){
      | ^~~~

ソースコード

diff #

#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;

//微分
P dif(P p){
    int a = p.first,b = p.second;
    if(!b)return P(0,0);
    return P(a * b,b - 1);
}
//Vにpを加える
void push(vector<ll> &V,P p){
    V[p.second] += p.first;
}
void dump(vector<ll> &V){
    for(auto i:V)cout << i << " ";//
    cout << endl;
}
void func(vector<ll> &V,P &p,int depth){
    if(!p.first){
        if(p.second)p.first = 1;
        else        p.first = 0;
    }
    rep(i,depth)dif(p);
    push(V,p);
    p.first = 0;p.second = 0;
}
main(){
    int N,D;
    cin >> N >> D;
    D++;
    vector<ll>V(D);
    P p(0,0);
    int cof = 0,deg = 0,depth = 0;//係数 次数 深さ
    string str,S;
    cin >> str;
    for(auto c:str)if(c != 'd')S += c;
    //cout << S << endl;

    for(auto c:S){
        if(c == '{'){
            depth++;
        }else if(c == '}'){
            depth--;
            func(V, p, depth);
        }else if(c == '+'){
            func(V, p, depth);
        }else if(c == '*'){      
        }else if(c == 'x'){            
            p.second++;
        }else{
            //数字
            p.first = (c - '0');
        }
    }
    func(V, p, depth);
    dump(V);
    
}
0