Submission #4199

# Submission time Handle Problem Language Result Execution time Memory
4199 2013-09-05T04:07:26 Z Hidden Inherited disease (kriii1_I) C++
0 / 1
0 ms 1088 KB
#include <stdio.h>

int main() {
	int c, p[100], tmp=1;
	long long num=0;
	int mod = 1000000007;
	scanf("%d", &c);
	for(int i=0;i<c;i++) {
		scanf("%d", &p[i]);
	}

	for(int i=0;i<c;i++) {
		if(i>0) {
			num=(num+p[i]+((i+1)*(p[i-1]-1))+(tmp-p[i-1]))%mod;
			p[i]+=(p[i-1]-1)*(i+1)%mod;
			tmp=(tmp*(i+1))%mod;
		}
		else
			num=(num+p[i])%mod;
		printf("%lld\n", num%mod);
	}
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1088 KB Output is correct
2 Incorrect 0 ms 1088 KB Output isn't correct
3 Halted 0 ms 0 KB -