Cod sursa(job #281774)
| Utilizator | Data | 15 martie 2009 21:51:48 | |
|---|---|---|---|
| Problema | Fractii | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.48 kb |
#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;
}
