Follows 138.c (Total 27 lines):

/* @JUDGE_ID:4461XX 138 C */
/* A */
#include <stdio.h>
unsigned long a[10] ;

unsigned long fun(int n)
{
	return a[n-1] * 6 - a[n-2];
}
unsigned long check(int n)
{
	unsigned long i;
	for( i = a[n] + 1 ; ; i++ )
	{
		if( a[n] * ( a[n] - 1 ) / 2 == (a[n] + 1 + i ) * ( i - a[n] ) / 2 )
			return i;
	}
}
void main(void)
{
	int i;
	a[1] = 6 ;
	a[2] = 35 ;
	for( i = 3 ; i <= 10 ; i++ )
		a[i] = fun( i );
	for( i = 1 ; i <= 10 ; i++ )printf("\n%10lu%10lu",a[i],check( i ));
}

Back to statistics
Ya-Lin Huang (C)
huangyl@gmail.com