Pagini recente » Cod sursa (job #221294) | Statistici Diyar Mert Daniel (prinnex) | Cod sursa (job #679980) | Cod sursa (job #1006924) | Cod sursa (job #281776)
Cod sursa(job #281776)
#include<fstream>
using namespace std;
int main(){
fstream in("fractii.in", ios::in);
fstream out("fractii.out", ios::out);
unsigned int x;
in>>x;
unsigned int ori=x;
bool v=1; unsigned int max;
for(int c=2;c<=x;c++){
ori++;
for(int k=2;k<=x;k++){
v=1;
if(c%k==0||k%c==0) { v=0; } else {
if(c<k) max=c; else max=k;
for(int l=2;l<=max!=1&&max/2;l++) if(c%l==0&&k%l==0) v=0;
}
if(v==1) ori++;
}}
out<<ori;
return 0;
}