Cod sursa(job #1657204)
Utilizator | Constantin-Buliga Stefan fanache99 | Data | 20 martie 2016 11:47:00 |
---|---|---|---|
Problema | Diamant | Scor | 90 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.75 kb |
#include<cstdio>
#include<cstring>
using namespace std;
int a[88210],b[88210];
int main(){
freopen("diamant.in","r",stdin);
freopen("diamant.out","w",stdout);
int n,m,k,i,j,t,x;
scanf("%d%d%d",&n,&m,&k);
if(k>44100)
printf("0");
else{
a[44100]=1;
for(i=1;i<=n;i++)
for(j=1;j<=m;j++){
for(t=88200;t>=0;t--)
b[t]=a[t];
for(t=88200;t>=0;t--){
a[t]=b[t];
if(t+i*j<=88200)
a[t]+=b[t+i*j];
if(t-i*j>=0)
a[t]+=b[t-i*j];
a[t]%=10000;
}
}
printf("%d\n",a[k+44100]);
}
return 0;
}