Submission #3489

# Submission time Handle Problem Language Result Execution time Memory
3489 2013-08-31T06:09:36 Z waps12b Inherited disease (kriii1_I) C++
0 / 1
0 ms 1088 KB
#include<cstdio>

#define Mod 1000000007
#define ll long long
int main() {
	int n;
	scanf("%d", &n);
	ll ord = 1, tmp, tot = 0, num = 1;
	for(int i = 1 ; i <= n ; i++) {
		scanf("%lld\n", &tmp);

		ll ans = tot+(ord-1)*i+tmp;
		printf("%lld\n", ans%Mod);
		num *= i;
		num %= Mod;
		if( i == 1 ) tot += 1;
		else tot += num;
	
		tot %= Mod;
		ord = tmp;
	}
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 1088 KB Output isn't correct
2 Halted 0 ms 0 KB -