Pagini recente » Cod sursa (job #1802766) | Cod sursa (job #1091089) | Cod sursa (job #1145218) | Cod sursa (job #915879) | Cod sursa (job #1295560)
#include <fstream>
#include <cstdlib>
using namespace std;
int main(){
fstream fin("fractii.in"),fout("fractii.out");
char *a; int n,i,j,s=0;
fin>>n;
a=(char*)malloc((n+1)*(n+1)*sizeof(char));
for(i=1;i<=n;i++)for(j=1;j<=n;j++)a[n*i+j]=0;
for(i=1;i<=n;i++)
for(j=1;j<=n;j++)
if(a[n*i+j]==0){
s++;
for(int k=1;i*k<=n && j*k<=n;k++)a[i*k*n+j*k]=1;
}
fout<<s;
return 0;
}