Opening the reading…
Opening the reading…
TIME AND SPACE COMPLEXITY / ONLINE JUDGE › TIME AND SPACE COMPLEXITY
This is a scratch drill — your code runs, nothing is graded or recorded. No test cases, no expected output, no verdict.
TASK
Complete the C++ program so it processes a = [4, 2, 7, 1] with the sequential loop and the dependent nested loops. Print sum = 14, prefixTotal = 37, the body counts 4 and 10, and their total cost 14.
OUTPUT
Samplesum = 14 prefixTotal = 37 sumCount = 4 prefixCount = 10 totalCost = 14
What a finished answer prints, from the lesson. Nothing has run yet — press Run and this is replaced by your program’s own output.