CSES - Harjoituskisa 14.1.2018 - Results
Submission details
Task:Alitaulukot
Sender:Nanohenry
Submission time:2018-01-14 21:27:03 +0200
Language:C++
Status:READY
Result:15
Feedback
groupverdictscore
#1ACCEPTED15
#20
Test results
testverdicttimegroup
#1ACCEPTED0.05 s1details
#2--2details

Code

#include <iostream>

using namespace std;

/*unsigned long getT(unsigned long val) {
	unsigned long sum = 1;
	for (unsigned long i = 1; i <= val; i++) {
		sum *= i;
	}
	return sum;
}*/

int main() {
	unsigned long n;
	cin >> n;
	unsigned long t[n];
	unsigned long sum = 0;
	for (unsigned long i = 0; i < n; i++) {
		unsigned long tmp;
		cin >> tmp;
		t[i] = tmp;
		sum += tmp;
		//sum += getT(tmp) * 2;
	}
	for (unsigned long length = 2; length <= n; length++) {
		for (unsigned long i = 0; i < n - (length - 1); i++) {
			for (unsigned long j = i; j < i + length; j++) {
				sum += t[j];
			}
		}
	}
	cout << sum % 1000000007;
	//while (1);
}

Test details

Test 1

Group: 1

Verdict: ACCEPTED

input
100
72 66 50 11 3 15 68 45 79 11 9...

correct output
9437440

user output
9437440

Test 2

Group: 2

Verdict:

input
100000
483398076 227177515 705421329 ...

correct output
179178131

user output
(empty)