Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

6/15 #14

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft

6/15 #14

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions problems/P12781.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
def ccw(first: list, second: list, third: list):
cross_porduct = (second[0] - first[0])*(third[1] - first[1]) - \
(third[0] - first[0])*(second[1] - first[1])
if cross_porduct > 0:
return 1
if cross_porduct < 0:
return -1
return 0


def comparator(left: list, right: list):
if left[0] == right[0]:
return left[1] <= right[1]
return left[0] <= right[1]


def solution(first: list, second: list):
first_scope = ccw(*first, second[0]) * ccw(*first, second[1])
second_scope = ccw(*second, first[0]) * ccw(*second, first[1])

if first_scope == 0 and second_scope == 0:
return False

return first_scope <= 0 and second_scope <= 0


def test_solution():
assert solution([[0, 0], [6, 2]], [[5, -4], [2, 2]]) == True
assert solution([[-1, -5], [6, 3]], [[1, 10], [-4, -1]]) == False


if __name__ == "__main__":
lines = list(map(int, input().split()))
if solution([lines[:2], lines[2:4]], [lines[4:6], lines[6:]]):
print(1)
else:
print(0)
16 changes: 16 additions & 0 deletions problems/P17174.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
def solution(amount: int, groupTO: int):
count = amount

while amount > 0:
amount //= groupTO
count += amount
return count


def test_solution():
assert solution(13, 10) == 14
assert solution(100, 8) == 113


if __name__ == "__main__":
print(solution(*map(int, input().split())))