JPMorgan ChaseOA #10
Tracks in Hackathon
Estimated EasyJudge-ready
Topics (AI-labelled)Bits & Math
Each person belongs to exactly one team, and each team has either a or b people. Split all p people into teams and find the minimum number of teams; output −1 if it is impossible.
Input
One line with a b p; full original bounds 1≤a,b,p≤100000.
Output
Output a single integer answer.
Example 1
Input:
3 4 7
Output:
2
Example 2
Input:
4 6 7
Output:
-1
Example 3
Input:
1 100 100
Output:
1
Example notes
The outputs of the three public examples are, in order: 2; -1; 1. These answers have been checked by independent enumeration or direct simulation.
Editorial
Loading solution…