Cod sursa(job #1573460)
| Utilizator | Data | 19 ianuarie 2016 18:29:31 | |
|---|---|---|---|
| Problema | Fractii | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.55 kb |
#include <iostream>
#include <fstream>
using namespace std;
int n,nr,a,b,k,x,y;
int main()
{
ifstream f("fractii.in");
ofstream g("fractii.out");
f>>n;
a=2;b=1;
nr=n;
while (a<=n)
{
while (b<=n)
{
k=0;
if (b==1) nr++;
else if ((a%2==0) and (b%2==0)) k=1;
else if ((a>b) and (a%b!=0) and (k==0)) nr++;
else if ((a<b) and (b%a!=0) and (k==0)) nr++;
b++;
}
a++;
b=1;
}
g<<nr;
return 0;
}
