Cod sursa(job #797888)

Utilizator stanescumalinStanescu Malin Octavian stanescumalin Data 15 octombrie 2012 09:29:42
Problema Pascal Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.58 kb
#include <iostream>
#include <fstream>

using namespace std;

int max(int a, int b)
{
    if(a < b) return b;
    else return a;
}
int main()
{
    int r, d, q, f, t, w;
    ifstream fin("pascal.in")
    fin>>r; fin>>d;
    q = r%2;
    f = r%3;
    t = r%4;
    w = r%5;
    if(d == 2)
    {
        fout << (R-2-2*q);
    }
    if(d == 3)
    {
        fout<<(R-2-2*f);
    }
    if(d == 4)
    {
        fout<<(R-2-2*t)
    }
    if(d == 5)
    {
        fout<<(R-2-2*w)
    }
    if(d == 6)
    {
        fout<<(R-2-2*min(q,f));
    }
    return 0;
}