結果

問題 No.265 数学のテスト
ユーザー itezpaceitezpace
提出日時 2016-10-28 08:25:48
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 844 bytes
コンパイル時間 1,513 ms
コンパイル使用メモリ 60,112 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-15 20:29:48
合計ジャッジ時間 2,647 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main(){
  int N=0;cin>>N;
  int d=0;cin>>d;
  string S;cin>>S;
  int dd=0,xx=0,a=1,f=0,s=0,e=0;
  vector<int> v(d+1);
  for(int i=0;i<S.size();++i){
    char c=S[i];
    if(c=='{'){
      s+=1;
      dd+=1;
    }
    if(c=='}'){
      e+=1;
      if(f==0) dd-=1;
    }
    if(c>='0' && c<='9'){
      a=c;
      a-=48;
      if(f==0) f=1;
    }
    if(c=='x'){
      xx+=1;
      if(f==0) f=1;
    }
    if(c=='+'){
      int b=a;
      for(int j=xx;j>=xx-(dd-1);--j){
        b*=j;
      }
      v[xx-dd]+=b;
      dd=s-e;
      a=1;
      xx=0;
      f=0;
    }
  }
  if(f==1){
    int b=a;
    for(int j=xx;j>=xx-(dd-1);--j){
    b*=j;
    }
    v[xx-dd]+=b;
  }
  for(int i=0;i<d+1;++i){
    if(i==0) cout<<v[i];
    else cout<<" "<<v[i];
  }
  cout<<endl;
}
0