Cod sursa(job #2156625)
Utilizator | Data | 8 martie 2018 21:17:36 | |
---|---|---|---|
Problema | Pascal | Scor | 30 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.44 kb |
#include<bits/stdc++.h>
using namespace std;
ifstream f("pascal.in");
ofstream g("pascal.out");
int n,d,sol,j,i;
unsigned long long L[5000001],L0[5000001];
int main()
{
f>>n>>d;
L0[0] = L0[1] = 1;
for (i=2; i<=n; ++i)
{
L[0] = 1;
for (j=1; j<i; ++j)
L[j] = L0[j-1] + L0[j];
L[i] = 1;
for (j=0; j<=i; ++j)
L0[j] = L[j];
}
for (i=1; i<=n; ++i)
if(L0[i]%d==0)
sol++;
g<<sol;
}