All Tracks Problem

Destroy the Monster
Tag(s):

Very-Easy

Problem
Editorial
Analytics

Erza is a fearless Warrior of her guild. She is fighting a monster with Power P. She is using her special armour which helps her to defeat her enemy easily. With each attack the power of her attack increases by X amount. But after \(i^{th}\) attack, she has to wait for i seconds to recharge her armour. Initial power of her attack is X.

Each attack takes 1 second. The enemy is defeated when its power reduces to 0 or below.

After every attack, the Power of monster reduces by the power of attack.

How much time does she takes defeating the monster?

Constraints:-
1 ≤ X ≤ 10
1 ≤ P\(10^{9}\)

Input Format:-
Single line consisting of 2 space-separated integers - P X

Output Format:-
Time taken by Erza to defeat the monster.

SAMPLE INPUT
8 3
SAMPLE OUTPUT
3
Time Limit: 1.0 sec(s) for each input file.
Memory Limit: 256 MB
Source Limit: 1024 KB
Marking Scheme: Marks are awarded when all the testcases pass.
Allowed Languages: Bash, C, C++, C++14, Clojure, C#, D, Erlang, F#, Go, Groovy, Haskell, Java, Java 8, JavaScript(Rhino), JavaScript(Node.js), Julia, Kotlin, Lisp, Lisp (SBCL), Lua, Objective-C, OCaml, Octave, Pascal, Perl, PHP, Python, Python 3, R(RScript), Racket, Ruby, Rust, Scala, Swift, Swift-4.1, TypeScript, Visual Basic

CODE EDITOR

Initializing Code Editor...
Your Rating:

Contributor

This Problem was Asked in

National Institute of Technology Jalandhar

Challenge Name

Sprint Challenge 1

OTHER PROBLEMS OF THIS CHALLENGE
通知
View All Notifications

?