Reading numbers in 0.1 seconds
Time limit0.1sMemory limit512 MB
Read up to five million natural numbers within 0.1 seconds and print how many were read and their sum.
- Level
Easy1 of 10
- Topics
- Implementation
- Solved
- No attempts yet
Problem
Read as many numbers as possible within 0.1 seconds. Read every natural number in the input, then print how many you read and their sum. Reading one line at a time with a slow routine misses the time limit, so pick the fastest input method your language provides.
Input
The first line contains the count of numbers . ()
Each of the next lines contains one natural number. Every number given is at most .
Output
Print the count of natural numbers you read on the first line, and their sum on the second line. The sum can exceed the range of a 32-bit integer.