QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#762355#8023. The Journey of Geor AutumnWRuperDCompile Error//C++201.4kb2024-11-19 14:44:182024-11-19 14:44:22

Judging History

This is the latest submission verdict.

  • [2024-11-19 14:44:22]
  • Judged
  • [2024-11-19 14:44:18]
  • Submitted

answer

#include<bits/stdc++.h>
using namespace std;
const long long inf = 1e18;
const int mininf = 1e9 + 7;
#define pb emplace_back
inline int read(){int x=0,f=1;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9'){x=(x<<1)+(x<<3)+(ch^48);ch=getchar();}return x*f;}
inline void write(int x){if(x<0){x=~(x-1);putchar('-');}if(x>9)write(x/10);putchar(x%10+'0');}
#define put() putchar(' ')
#define endl puts("")
const int MAX = 1e7 + 10;
const long long mod = 998244353;
int f[MAX];
int preasd[MAX];
int inv123[MAX];
int F114[MAX];

void solve(){
	int n = read(), k = read();
	f[0] = 1;
	int pre = 1ll * f[0] * preasd[n - 1] % mod;
	for(int i = 1; i <= n; i++){df
		if(i - k - 1 >= 0){
			pre = 1ll * (1ll * pre + 1ll * mod - 1ll * f[i - k - 1] * 1ll * preasd[n - (i - k - 1) - 1] % mod) % mod;
		}
		f[i] = 1ll * pre * F114[n - i] % mod;
		pre = 1ll * (1ll * pre + 1ll * f[i] * 1ll * preasd[n - i - 1] % mod) % mod; 
	}
	write(f[n]), endl;
}

signed main(){
	// freopen("b.in", "r", stdin);
	// freopen("b.out", "w", stdout);
	preasd[0] = F114[0] = 1;
	preasd[1] = inv123[1] = F114[1] = 1;
	for(int i = 2; i < MAX; i++){
		preasd[i] = 1ll * preasd[i - 1] * i % mod;
		inv123[i] = 1ll * inv123[mod % i] * (mod - mod / i) % mod;
		F114[i] = 1ll * F114[i - 1] * inv123[i] % mod;
	}
	int t = 1;
	while(t--)	solve();
	return 0;
}

Details

answer.code: In function ‘void solve()’:
answer.code:21:37: error: ‘df’ was not declared in this scope; did you mean ‘f’?
   21 |         for(int i = 1; i <= n; i++){df
      |                                     ^~
      |                                     f