Cod sursa(job #1799161)
Utilizator | Data | 5 noiembrie 2016 20:56:14 | |
---|---|---|---|
Problema | 1-sir | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.45 kb |
#include <iostream>
#include <fstream>
#define nmax 256
using namespace std;
int n,dp[nmax+1][nmax*nmax];
long long Starget,Smax,s;
int main()
{
ifstream fin ("1-sir.in");
ofstream fout("1-sir.out");
fin>>n>>Starget;
Smax=n*(n-1)/2;
s=Smax-Starget;
for(int i=1;i<=n;i++)
{
for(int j=1;j<=s;j++)
{
dp[i][j]=dp[i-1][j-2*(n-i+1)]+1;
}
}
fout<<dp[n][s];
return 0;
}