제출 #1326871

#제출 시각아이디문제언어결과실행 시간메모리
1326871Faisal_SaqibJump (BOI06_jump)C++20
컴파일 에러
0 ms0 KiB
#include <iostream> #include <algorithm> using namespace std; typedef long long ll; const int N=102; const ll base=1e9; struct bigint { vector<ll> tp; bigint(ll x) { while(x) { tp.push_back(x%base); x/=base; } } bigint() { tp.push_back(0); } }; void print(bigint a) { while(a.tp.size()>1 and a.tp.back()==0)a.tp.pop_back(); int sa=a.tp.size(); // cout<<"Hola "<<a.tp.size()<<endl; for(int i=sa-1;i>=0;i--) { cout<<a.tp[i]; } cout<<endl; } bigint add(bigint a,bigint b) { bigint c; int sa=a.tp.size(); int sb=b.tp.size(); c.tp.resize(max(sa,sb)+1,0); ll cry=0; for(int i=0;i<=max(sb,sa);i++) { ll cc=cry; if(i<sa)cc+=a.tp[i]; if(i<sb)cc+=b.tp[i]; c.tp[i]=cc%base; cry=cc/base; } while(c.tp.size()>1 and c.tp.back()==0)c.tp.pop_back(); return c; } bigint dp[N][N]; int g[N][N]; int main() { int n; cin>>n; for(int i=1;i<=n;i++) { for(int j=1;j<=n;j++) { g[i][j]=1; // cin>>g[i][j]; } } dp[n][n]=1; for(int i=n;i>=1;i--) { for(int j=n;j>=1;j--) { if(g[i][j]==0)continue; if(j+g[i][j]<=n) dp[i][j]=add(dp[i][j],dp[i][j+g[i][j]]); if(i+g[i][j]<=n) dp[i][j]=add(dp[i][j],dp[i+g[i][j]][j]); } } print(dp[1][1]); }

컴파일 시 표준 에러 (stderr) 메시지

jump.cpp:9:5: error: 'vector' does not name a type
    9 |     vector<ll> tp;
      |     ^~~~~~
jump.cpp: In constructor 'bigint::bigint(ll)':
jump.cpp:14:13: error: 'tp' was not declared in this scope; did you mean 'tm'?
   14 |             tp.push_back(x%base);
      |             ^~
      |             tm
jump.cpp: In constructor 'bigint::bigint()':
jump.cpp:20:9: error: 'tp' was not declared in this scope; did you mean 'tm'?
   20 |         tp.push_back(0);
      |         ^~
      |         tm
jump.cpp: In function 'void print(bigint)':
jump.cpp:25:13: error: 'struct bigint' has no member named 'tp'
   25 |     while(a.tp.size()>1 and a.tp.back()==0)a.tp.pop_back();
      |             ^~
jump.cpp:25:31: error: 'struct bigint' has no member named 'tp'
   25 |     while(a.tp.size()>1 and a.tp.back()==0)a.tp.pop_back();
      |                               ^~
jump.cpp:25:46: error: 'struct bigint' has no member named 'tp'
   25 |     while(a.tp.size()>1 and a.tp.back()==0)a.tp.pop_back();
      |                                              ^~
jump.cpp:26:14: error: 'struct bigint' has no member named 'tp'
   26 |     int sa=a.tp.size();
      |              ^~
jump.cpp:30:17: error: 'struct bigint' has no member named 'tp'
   30 |         cout<<a.tp[i];
      |                 ^~
jump.cpp: In function 'bigint add(bigint, bigint)':
jump.cpp:37:14: error: 'struct bigint' has no member named 'tp'
   37 |     int sa=a.tp.size();
      |              ^~
jump.cpp:38:14: error: 'struct bigint' has no member named 'tp'
   38 |     int sb=b.tp.size();
      |              ^~
jump.cpp:39:7: error: 'struct bigint' has no member named 'tp'
   39 |     c.tp.resize(max(sa,sb)+1,0);
      |       ^~
jump.cpp:44:23: error: 'struct bigint' has no member named 'tp'
   44 |         if(i<sa)cc+=a.tp[i];
      |                       ^~
jump.cpp:45:23: error: 'struct bigint' has no member named 'tp'
   45 |         if(i<sb)cc+=b.tp[i];
      |                       ^~
jump.cpp:46:11: error: 'struct bigint' has no member named 'tp'
   46 |         c.tp[i]=cc%base;
      |           ^~
jump.cpp:49:13: error: 'struct bigint' has no member named 'tp'
   49 |     while(c.tp.size()>1 and c.tp.back()==0)c.tp.pop_back();
      |             ^~
jump.cpp:49:31: error: 'struct bigint' has no member named 'tp'
   49 |     while(c.tp.size()>1 and c.tp.back()==0)c.tp.pop_back();
      |                               ^~
jump.cpp:49:46: error: 'struct bigint' has no member named 'tp'
   49 |     while(c.tp.size()>1 and c.tp.back()==0)c.tp.pop_back();
      |                                              ^~