Cod sursa(job #638418)

Utilizator thesilverhand13FII Florea Toma Eduard thesilverhand13 Data 20 noiembrie 2011 20:54:33
Problema Dirichlet Scor 8
Compilator cpp Status done
Runda .com 2011 Marime 0.47 kb
 
 # include <fstream>
 
 using namespace std;
 
 ifstream f("dirichlet.in");
 ofstream g("dirichlet.out");
 
 int n;
 long long  sol , C[ 2 ];

 long long rezolva()
{
    long long i,x;
	if ( n < 2 )
		return 1;
	C[ 0 ] = ( long long )( 1 );
	for( i = 2 ; i <= n ; i++ )
	{
		x = C[ 0 ];
		x  = x * ( 4 * i - 2 );
	
		x = x / ( i + 1 );
		C[ 1 ] = x;
		C[ 0 ] =C[ 1 ];
	}
	return C[ 1 ];
}

int main()
{
	
	f >> n;
	
	g << rezolva();
	return 0;
}