Submit solution

Points:
3 (partial)

Time limit:
2.0s

Memory limit:
16M

Authors:

Problem types

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

Fardin is planning to buy presents for all his teachers. However, he only has dollars! Given number of presents Fardin wants to buy, output how much money he will have left. If he is unable to buy all the presents, output `Fardin's broke`

.

#### Input Specification

Line 1:

Line 2:

The next lines each contain the price of a present. All prices will be given to two decimal places.

#### Output Specification

If Fardin cannot buy all the presents, output the string `Fardin's broke`

. Otherwise, output to 2 decimal places how much money Fardin has left.

#### Sample Input

```
4
20.00
2.45
6.54
3.19
1.44
```

#### Sample Output

`6.38`

#### Sample Input

```
2
5.00
3.14
2.71
```

#### Sample Output

`Fardin's broke`

## Comments

Hello, I can't seem to input an amount of money because it says this: ValueError: invalid literal for int() with base 10: '20.00'. I'm using python 3 so if anyone can help, it'll be much appreciated. Thank you!

Case 2 and 5, is

`0`

the wrong answer? Is it supposed to print something else, or is there something to do with rounding and he can't actually afford it?You need to round to two decimal points for your answer to work(i.e.

`0.00`

not`0`

or`0.0`

).ah, thanks

In Turing, case 5 evaluates to an error margin of 2.664535e-15

Test Case 5 while working in Java does not seem to be working.

I think this has something to do with how floating points are subtracted.

2 hints: 1) 1 cent = $0.01 2) Why are you subtracting?

3rd hint: See my other comment.

Has the test data been fixed because this seems like a really simple problem but I keep getting one case incorrect (case 5).

the test data is fixed, doing this in C++ is just kind of a challenge due to double precision errors

there are some workarounds, but i'll leave it to you to find them :P

Hello, not sure if this is an error in observation but the test data appears to be incorrect. For test case 2 and 5, both of them have equal and total gift cost but they do not have the same answer.

I have noticed this too.

You seem to be correct. One of the output files were incorrect due to python precision errors. Data will be fixed and submissions will be rejudged, sorry to everyone for the inconvenience.

please don't derate this contest due to this ;(

https://dmoj.ca/contest/gfssoc3j

This contest will be unratedThank you!