Pagini recente » Cod sursa (job #1635718) | Monitorul de evaluare | Autentificare | Istoria paginii runda/tema_2 | Cod sursa (job #2366945)
#include <bits/stdc++.h>
using namespace std;
int main()
{
int s,n;
cin >> n >> s;
int osszeg=n*(n-1)/2-s;
int a[256];
int m=0;
int b[256];
int megoldasok[100][100];
for (int i=1;2*i<=osszeg;i++)
{
a[i]=2*i;
m++;
megoldasok[2*i][1]=1;
}
for (int i=6;i<=osszeg;i+=2)
for (int j=2;j<=m;j++)
{
megoldasok[i][j]=0;
for (int q=4;q<i;q+=2)
if (q>i/2)
megoldasok[i][j]+=megoldasok[i-q][j-1];
if (megoldasok[i][j]%194767>0)
megoldasok[i][j]=megoldasok[i][j]%194767;
} for (int i=2;i<=osszeg;i+=2)
{
for (int j=1;j<=m;j++)
cout<<megoldasok[i][j]<<" ";
cout<<endl;
}
int lofasz=0;
for (int j=1;j<=m;j++)
lofasz+=megoldasok[osszeg][j];
cout<<lofasz;
//tablazaat: melyik osszeg, hany elembol -> kiir a[n][n](utolso elem)
return 0;
}