Cod sursa(job #1799163)

Utilizator alexutzualex alex alexutzu Data 5 noiembrie 2016 20:59:16
Problema 1-sir Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.44 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*i]+1;
        }
    }
    fout<<dp[n][s];
    return 0;
}