Mock CCC '19 Contest 2 J3 - Tudor Buys Some Tea

View as PDF

Submit solution


Points: 3 (partial)
Time limit: 1.0s
Memory limit: 1G

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

Tudor, having made his own tea for far too long, has decided to go to a nearby tea shop to buy some tea.

As every respectable tea shop does, this specific tea shop offers a loyalty program. For every K cups of tea that Tudor buys at the shop, the shop will give him one free cup of tea.

Tudor wants to drink at least N cups of tea. How many cups of tea will he have to buy in order to achieve this goal?

Constraints

1 \le N, K \le 10^{18} - note that 32-bit integers may not be sufficient to solve this problem.

In tests worth 5 marks, N = K.

Input Specification

The input will consist of a single line containing two positive integers, N and K.

Output Specification

Output, on a single line, the minimum number of cups of tea Tudor needs to buy.

Sample Input

11 10

Sample Output

10

Sample Explanation

This tea shop is very traditional and gives a free cup of tea per 10 bought. If Tudor buys 10 cups of tea, he'll end up with 11, which is perfect.


Comments


  • 0
    bagel  commented on Feb. 11, 2020, 11:26 a.m.

    How come Batch two is all WC?