Created
May 11, 2021 15:53
-
-
Save dongwooklee96/af41e446954adfcd44900dbe8f295ca2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# BOJ 1712 손익분기점 | |
def solve(a, b, c): | |
n = c - b | |
if n <= 0: | |
return -1 | |
else: | |
return a // n + 1 | |
if __name__ == '__main__': | |
a, b, c = map(int, input().split()) | |
print(solve(a, b, c)) | |
# test case | |
def test_case1(): | |
assert solve(1000, 70, 170) == 11 | |
def test_case2(): | |
assert solve(3, 2, 1) == -1 | |
def test_case3(): | |
assert solve(2100000000, 9, 10) == 2100000001 | |
def test_case4(): | |
assert solve(1, 8, 10) == 1 | |
def test_case5(): | |
assert solve(100, 60, 60) == -1 | |
def test_case6(): | |
assert solve(9, 60, 63) == 4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment