Almond problem
Practice
5 (1 votes)
Open
Open
Open
Ad Hoc
Math basic
Simple Math
Basic math
Easy
Mathematics
Math
Problem
87% Success 195 Attempts 30 Points 1s Time Limit 256MB Memory 1024 KB Max Code

Initially, there are \(K\) number of almonds in the bowl. Alice eats \(A\) almonds in the morning and \(B\) number of almonds is added to her bowl in the evening. Your task is to determine the number of consecutive days for which Alice will be able to eat almonds.

Input format

  • First line: \(T\) denoting the number of test cases
  • For each test case
    • First line: \(A\) 
    • Second line: \(B\)
    • Third line: \(K\)

Output format

Print the answer for each test case in a new line. If the activity regarding almonds cannot stop forever, then print \(-1\).

Constraints

\(1 \le T \le 5 \)

\(0 \le A \le 10^9 \)

\(0 \le B \le 10^9 \)

\(0 \le K \le 10^9 \)

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:30
33 votes
Tags:
Dijkstra's algorithmEasyGraphsOpenShortest Path Algorithm
Points:30
162 votes
Tags:
MediumImplementationRecursionTreeMathematicsApproved
Points:30
5 votes
Tags:
Linear AlgebraAlgorithmsMatrix ExponentiationMath