Cod sursa(job #2517690)

Utilizator drknss_Hehe hehe drknss_ Data 3 ianuarie 2020 22:53:37
Problema Diamant Scor 100
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.63 kb
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(a) (a).begin(), (a).end()
#define forn(i,a,b) for (int i = a; i <= b; i++)
const ll mod = 10000;
int x, n, m, a[170000], b[170000];

int32_t main(){
ios_base::sync_with_stdio(0); cin.tie(); cerr.tie(); cout.tie();
ifstream cin("diamant.in");
ofstream cout("diamant.out");
	cin>>n>>m>>x;
	a[44100]=1;
if(abs(x)<=44100){
	forn(i,1,n){
		forn(j,1,m){
			memcpy(b,a,sizeof(a));
			for(int k = 88000; k >= 0; k--){
				a[k]=b[k-i*j]+b[k]+b[k+i*j];
				a[k]%=mod;
			}
		}
	}
}
	if(abs(x)<=44100)cout<<a[44100+x];else cout<<"0";
return 0;
}