## Back To School '17: Physics

View as PDF

Points: 5 (partial)
Time limit: 3.0s
Memory limit: 256M

Author:
Problem type
Allowed languages
Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, CommonLisp, D, Dart, F#, Forth, Fortran, Go, Groovy, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, Nim, ObjC, OCaml, Octave, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig

To scientifically round a real number, find the integer that is the closest to the real number. If there are two equally close integers, choose the even integer. A few examples are listed in the table below.

Real number Rounded value Comment   is the closest integer to .   and are equally close to , but is chosen because it is even.   is the closest integer to . In fact, they are the same number.

In the remainder of the problem statement, will refer to the rounded value of .

Percentages may not add up to 100% due to rounding.

Wilson is learning about how to scientifically round numbers to the nearest integer on the first day of his physics class. A little later, Wilson is trying out some easy physics problems; he adds up a bunch of distances and scientifically rounds the sum. Sometimes Wilson wonders about the accuracy of his results.

On his next problem, he needs to add together distances. The distance is metres and the answer is metres. Wilson changes the distance to metres and soon forgot . By doing this, he introduced multiple possible answers to his physics problem. Now, Wilson doesn't know the possible answers!

What is the minimum and maximum possible answer to the physics problem?

#### Constraints

For of the points, and .

For of the points, and .

If exactly one output is wrong, of the points will be awarded for that test case.

#### Input Specification

The first integer will contain .

On each of the next lines, the of these lines will contain the integer .

#### Output Specification

The first line should contain the minimum possible value of .

The second line should contain the maximum possible value of .

Each value should be an integer, and do not print the integer with a . character.

#### Sample Input 1

1
5

#### Sample Output 1

5
5

#### Sample Input 2

2
49
50

#### Sample Output 2

98
100

#### Sample Input 3

3
10
10
10

#### Sample Output 3

28
32

#### Explanation for Sample Output 3 can be achieved with since . can be achieved with since .

• commented on Sept. 10, 2017, 7:22 p.m.

for sample output 3, doesn't round(28.5)=29, and round(10.5)=11

• commented on Sept. 10, 2017, 8:43 p.m.

If there are two equally close integers, choose the even integer.

• commented on Sept. 10, 2017, 1:12 p.m.

I got 1 case wrong, and got an 85/100. I got 2 cases wrong and got 90/100. Is this intended?

• commented on Sept. 10, 2017, 6:50 p.m.

There are partials for test cases. So it may say AC and say 3/5 on the side instead of 5/5. This means that you only got one of the answers correct.

• commented on Sept. 9, 2017, 11:17 p.m.

I couldn't get #17 and #15 together, only one or the other. But hardcoding is against the rules, it's kinda cheating.