A 3D Batch of Grayscale Images
Larkspur Labs' sensor rig writes tiny 2-by-2 grayscale thumbnails, one per exposure, and stores each one as a single line of four brightness values — the top row of the thumbnail first, then the bottom row. The exposure controller does not care what any picture looks like; it only wants to know how much light each exposure caught in total, so it can flag the ones that came back dark. The starter code has already folded the batch into n separate 2-by-2 pictures for you.
Task: Print each exposure's total brightness.
Input
The first line holds an integer n, the number of exposures. Each of the next n lines holds that exposure's four brightness values separated by single spaces.
Output
n lines, one per exposure, in the order the exposures were read. Each line holds that exposure's total brightness as a plain integer.
Example:
Input:
2
1 2 3 4
10 10 10 10
Output:
10
40
Sign in to solve this problem
Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.
Sign in