Building and Checking an Identity Matrix
Every stage of Larkspur Labs' colour pipeline is described by a square table with one row and one column per channel. On start-up the pipeline runs a stage that changes nothing at all: the do-nothing table, which carries a 1 wherever a channel maps to itself and a 0 everywhere else. The self-test then reports a single figure from that table — the total of the entries lying on the line that runs from the table's top-left corner to its bottom-right corner — and the operator checks it against the channel count printed on the rig.
Task: Print the self-test figure for a do-nothing table of n channels.
Input
One line holding a single integer n, the number of channels.
Output
One line holding the self-test figure as a plain integer.
Example:
Input:
4
Output:
4
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