Input Help
There are a few different common input formats on Learneroo.com, which are summarized below. (See also the challenge on the bottom of the Scanner Reference.)
List of Number Pairs
The first line of input contains an integer n
. n
. lines follow, each containing a pair of integers.
Example
5 1 2 10 20 -5 37 12345 0 5 5
List of List of Numbers
The first line contains a number m
. m
cases follow,
with each case consisting of two lines:
- A number
t
on the first line -
t
numbers follow on the next line.
t
can be ignored but helps get the input in Java and C++. The list of numbers is usually put in an array
for your code to do something with.
Example
4 4 1 2 3 4 5 300 460 700 150 530 8 -11 17 23 431 -329 443 100 -250 10 0 1 0 12345 -12345 0 1 2 3 4
List of Words
The first line of input will contain a number p. p lines follow, with each line containing a single word.
Example
4 Jim Sarah jello abc123