Pagini recente » Cod sursa (job #1457643) | Cod sursa (job #468612) | Monitorul de evaluare | Cod sursa (job #2592280) | Cod sursa (job #237075)
Cod sursa(job #237075)
/***************************************************************************
* Copyright (C) 2008 by cata,,, *
* cata@cata-laptop *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <iostream>
#include <cstdlib>
#include<fstream>
#define dim 1000000
using namespace std;
ifstream f("/home/cata/te/src/fractii.in");
ofstream g("/home/cata/te/src/fractii.out");
int fi(int n)
{
int result = n,i;
for( i=2;i*i <= n;i++)
{
if (n % i == 0) result -= result / i;
while (n % i == 0) n /= i;
}
if (n > 1) result -= result / n;
return result;
}
int main(int argc, char *argv[])
{
long long n, b,a,k=0;float nr;
f>>n;
for(b=2;b<=n;b++)
k=k+fi(b);
// k=k+2*nr;
g<<2*k+1;
f.close();
g.close();
return EXIT_SUCCESS;
}