Cod sursa(job #1107526)
Utilizator | Data | 13 februarie 2014 22:31:40 | |
---|---|---|---|
Problema | Ciurul lui Eratosthenes | Scor | 10 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.36 kb |
#include <iostream>
#include <fstream>
using namespace std;
int main()
{int n,i,x,y,o;
ifstream f("ciur.in");
ofstream g("ciur.out");
f>>n;
o=0;
for(i=1;i<=n;i++)
{
x=i;y=n;
while(x!=y)
if(x>y)
x=x-y;
else
y=y-x;
if(x==1)o++;
}g<<o;
return 0;
}