Mai intai trebuie sa te autentifici.
Cod sursa(job #281776)
Utilizator | Data | 15 martie 2009 21:53:23 | |
---|---|---|---|
Problema | Fractii | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.49 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;
}