Previous Next
0 / 15
Module DEMO-33-66DEMO-OOP-33

Prefix Sum Snapshot

DEMO-OOP-33 โ€ข Object Oriented Programming

Browser-only practice

Problem Statement

Read five integers and print the sequence of prefix sums.

Input Format

Input is given as whitespace-separated tokens in this order:

  1. first value
  2. second value
  3. third value
  4. fourth value
  5. fifth value

Output Format

Print the exact report in this order:

  1. Prefix

Sample Testcases

Submit runs every public testcase in this browser. Results and code never leave this device.

Sample #1
Public sample
1
2
3
4
5
Prefix: 1 3 6 10 15
Input: first value = 1, second value = 2, third value = 3, fourth value = 4, fifth value = 5.
Key calculation(s): values = {1, 2, 3, 4, 5} | running = 0 | "Prefix: " + prefix.toString() = "Prefix: 1 3 6 10 15".
Output:
Prefix: 1 3 6 10 15
Sample #2
Public sample
5
5
5
5
5
Prefix: 5 10 15 20 25
Input: first value = 5, second value = 5, third value = 5, fourth value = 5, fifth value = 5.
Key calculation(s): values = {5, 5, 5, 5, 5} | running = 0 | "Prefix: " + prefix.toString() = "Prefix: 5 10 15 20 25".
Output:
Prefix: 5 10 15 20 25

Web terminal

C, C++, Java, and Python run locally in a browser VM. No worker or visualizer is used.

Saved in this browser
Editor settings