Cod sursa(job #2482660)

Utilizator TheRealGamerFat Vlad TheRealGamer Data 28 octombrie 2019 18:20:32
Problema Pascal Scor 20
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.35 kb
#include <iostream>
#include <fstream>
using namespace std;

ifstream in("pascal.in");
ofstream out("pascal.out");

int main(){
    int n, p = 1, k, z = 0;
    in>>n>>k;
    if(1 % k == 0)
        z++;
    for(int i = 1; i <= n; i++){
        p = p * (n - i + 1) / i;
        if(p % k == 0)
            z++;
    }
    out<<z;
    return 0;
}