Cod sursa(job #2033789)
| Utilizator | Data | 7 octombrie 2017 10:43:09 | |
|---|---|---|---|
| Problema | Pascal | Scor | 30 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.52 kb |
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull ;
ifstream f("pascal.in");
ofstream g("pascal.out");
ull putere(ull n,ull div)
{
ull s=0,p=div;
while (n/div)
{
s+=n/div;
div*=p;
}
return s;
}
int main()
{
ull r,d,s=0,inloc=0,a,b,c;
f>>r>>d;
for (ull i=1;i<=r;++i)
{
a=putere(r,d); b=putere(r-i,d); c=putere(i,d);
if (a-b-c>=1)
{
s++;
}
}
g<<s;
return 0;
}
