不是,为啥一直编译错误啊,有人跟我一样吗

P1641 [SCOI2010] 生成字符串

```cpp #include <cstdio> #include <iostream> #include <vector> #include <cstring> #include <algorithm> #include <queue> #include <cstdlib> #include <ctime> #include <cmath> #define f(c,a,b) for(int c=a; c<=b; c++) #define N 2000010 #define pii pair<int,int> #define mp make_pair #define fi first #define se second #define sl (u<<1) #define sr ((u<<1)+1) #define pb push_back #define eps 1e-8 using namespace std; typedef double db; typedef long long ll; const int mo = 20100403; ll jc[N]={1}; ll fp(ll a, ll b){ // a^b ll t = a, ans = 1; for (int i=0; (1LL<<i)<=b; i++) { if( (1LL<<i)&b ) ans = ans*t % mo; t = t*t % mo; } return ans; } //费马小定理 ll my_inv(ll a) { return fp(a,mo-2); } //扩展欧几里得 ll c(ll n, ll m) { return jc[n]*my_inv(jc[m])%mo*my_inv(jc[n-m])%mo; } int main(){ // freopen("owo.in","r",stdin); // ios::sync_with_stdio(false); // cin.tie(nullptr); int n,m; cin>>n>>m; if(m==1){ cout<<1<<endl; return 0; } f(i,1,N-1) jc[i]=(jc[i-1]*i)%mo; ll a=c(n+m,n), b=c(n+m,n+1); // cout<<a<<' '<<b<<endl; cout<< ( (a-b)%mo+mo )%mo << endl; return 0; } ```
by dwbcz @ 2021-05-13 15:12:03


``` ll jc[N]={1}; ``` 不要在这里初始化,改成 ``` ll jc[N]; ... main(){ jc[0]=1; } ```
by dottle @ 2021-05-13 15:24:30


@[dwbcz](/user/42892)
by dottle @ 2021-05-13 15:25:43


@[dottle](/user/79067) 它过了,蟹蟹~能弱弱的问一句为什么嘛
by dwbcz @ 2021-05-14 14:14:55


考古
by 岂非 @ 2023-06-23 22:53:06


考古
by littlesnake @ 2024-01-18 09:49:57


|