Submission #3593

# Submission time Handle Problem Language Result Execution time Memory
3593 2013-08-31T06:46:42 Z wclee2265 Inherited disease (kriii1_I) C++
0 / 1
0 ms 1088 KB
#include <stdio.h>

#define MOD 1000000007
#define N 105

FILE *in=stdin;
FILE *out=stdout;

int n;
long long d[N];

int main()
{
	int i,j;
	long long total=1,tmp,t=1;
	fscanf(in,"%d",&n);
	for(i=1;i<=n;i++)
	{
		fscanf(in,"%lld",&d[i]);
		for(j=1,tmp=0;j<i;j++)
		{
			d[j]*=i;
			d[j]%=MOD;
			tmp+=d[j];
			tmp%=MOD;
		}
		fprintf(out,"%lld\n",(total+tmp+d[i]-1)%MOD);
		d[i]--;
		t*=i;
		t%=MOD;
		total+=t;
		total%=MOD;
	}
	fclose(in);
	fclose(out);
	return 0;
}

			
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 1088 KB close (syscall #3) was called by the program (disallowed syscall)
2 Halted 0 ms 0 KB -