結果
| 問題 | No.265 数学のテスト |
| コンテスト | |
| ユーザー |
Bantako
|
| 提出日時 | 2018-05-31 00:15:00 |
| 言語 | C++14 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,330 bytes |
| 記録 | |
| コンパイル時間 | 1,566 ms |
| コンパイル使用メモリ | 171,120 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-06-30 08:27:15 |
| 合計ジャッジ時間 | 2,666 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 3 |
| other | AC * 6 WA * 26 |
コンパイルメッセージ
main.cpp:32:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
32 | main(){
| ^~~~
ソースコード
#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);
}
Bantako