Cod sursa(job #2703620)

Utilizator gasparrobert95Gaspar Robert Andrei gasparrobert95 Data 8 februarie 2021 20:30:59
Problema Pascal Scor 10
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.43 kb
#include <bits/stdc++.h>
#define ll long long
using namespace std;
ifstream fin("pascal.in");
ofstream fout("pascal.out");
ll n, d, rez;

int main() {
    fin >> n >> d;
    if (d > n) {
        fout << 0;
        return 0;
    }
    for (int j = 0; j <= n / 2; ++j)
        if (n / d - (n - j) / d > 0)
            ++rez;
    rez *= 2;
    if (n % 2 == 0 && rez > 0)
        --rez;
    fout << rez;
    return 0;
}