#CCBCHMOT0000040. Đọc nhiều số đến hết tệp (Sum and Count Until EOF)
Đọc nhiều số đến hết tệp (Sum and Count Until EOF)
Sum and Count Until EOF
Source: Phước Hưng OJ
Version: Phuoc Hung OJ Extended
Problem Statement
The input is one finite stream of signed integers, possibly empty, with no leading count. Read all integers until EOF, then print their sum and number of elements, separated by one space.
Input
There is no count n. Integers are separated by whitespace, and the file may be empty.
Output
Print two integers on one line: sum and count.
Subtasks
- Subtask 1 (20%): At most 5 integers; each has absolute value at most 10.
- Subtask 2 (30%): At most 200 integers; each has absolute value at most .
- Subtask 3 (50%): At most integers; each has absolute value at most .
Examples
Example 1
Input
2 -5 7
Output
4 3
Explanation
The sum is 2-5+7=4 and there are three integers.
Example 2
Input
Output
0 0
Explanation
The empty input has sum zero and count zero.