逆天 WA0pts求调
查看原帖
逆天 WA0pts求调
701254
Mu_leaf楼主2024/6/22 14:54

模拟赛打的,对拍与大样例全过,但交上去全WA。

#include <bits/stdc++.h>
#define int long long

using namespace std;
namespace IO
{
	char buff[1<<21],*p1=buff,*p2=buff;
	char getch(){return p1==p2&&(p2=((p1=buff)+fread(buff,1,1<<21,stdin)),p1==p2)?EOF:*p1++;}
	template<typename T>
	void read(T &x){char ch=getch();int fl=1;x=0;while(ch>'9'||ch<'0'){if(ch=='-')fl=-1;ch=getch();}while(ch<='9'&&ch>='0'){x=x*10+ch-48;ch=getch();}x*=fl;}
	template<typename T,typename ...Args>
	void read(T &x,Args& ...args){read(x);read(args...);}
	char obuf[1<<21],*p3=obuf;
	void putch(char ch) {if(p3-obuf<(1<<21))*p3++=ch;else fwrite(obuf,p3-obuf,1,stdout),p3=obuf,*p3++=ch;}
	char ch[100];
	template<typename T>
	void write(T x) {if(!x)return putch('0');if(x<0)putch('-'),x*=-1;int top=0;while(x)ch[++top]=x%10+48,x/=10;while(top)putch(ch[top]),top--;}
	template<typename T,typename ...Args>
	void write(T x,Args ...args) {write(x);write(args...);}
	void put(string s){for(int i=0;i<s.size();i++)putch(s[i]);}
	void flush(){fwrite(obuf,p3-obuf,1,stdout);}
}
using namespace IO;
const int N=5e3+5,mod=10000;
int f[N][N],sum[N];//f[i][j]鍓峣涓暟鏈夊灏戜釜鍏ㄦ帓鍒楃殑閫嗗簭瀵规暟涓簀
int n,k;
signed main(){
	freopen("dp.in","r",stdin);
	freopen("1.out","w",stdout);
	read(n,k);
    f[1][0]=1;
    for(int i=2;i<=n;i++){
        sum[0]=1;
        for(int j=1;j<=k;j++) sum[j]=(sum[j-1]+f[i-1][j])%mod;
        for(int j=0;j<=k;j++){
            f[i][j]=(f[i][j]+sum[j]-sum[j-min(i-1,k)-1]+mod)%mod;
        }
    }
    write(f[n][k]);
	flush();
} 
2024/6/22 14:54
加载中...