Cod sursa(job #2016609)
Utilizator | Data | 29 august 2017 20:50:08 | |
---|---|---|---|
Problema | Fractii | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.73 kb |
#include <bits/stdc++.h>
using namespace std;
ifstream in("fractii.in");
ofstream out("fractii.out");
int main()
{
int N,m,l;
double P,Q,a[100];
bool bol = false;
in >> N;
l=1;
for (P=1; P<=N; P++)
{
for (Q=1; Q<=N; Q++)
{
for (int i=1; i<=l; i++)
{
if (a[i] == P/Q) //fractia a mai existat
{
bol = true;
}
}
if (bol == false)
{
m++;
a[l] = P/Q;
l++;
}
bol = false;
}
}
out << m;
//in.close();out.close();
return 0;
}