def test_floor_sum_failed_if_invalid_input_is_given( self, n: int, m: int, a: int, b: int) -> None: ''' floor_sum(n, m, a, b) is expected to be raised an AssertionError if an invalid input is given. GIVEN parameter n(< 1), m(< 1), a, b WHEN floor_sum(n, m, a, b) is called THEN raises an AssertionError ''' with pytest.raises(AssertionError): floor_sum(n, m, a, b)
def test_floor_sum_using_acl_practice_contest(self, n: int, m: int, a: int, b: int, expected: int) -> None: ''' Run floor_sum(n, m, a, b) using samples of ACL Practice Contest See: https://atcoder.jp/contests/practice2/tasks/practice2_c ''' assert floor_sum(n, m, a, b) == expected
def test_floor_sum(self) -> None: ''' floor_sum(n, m, a, b) is expected to return Σfloor((a * i + b) // m). GIVEN parameter n(>= 1), m(>= 1), a, b WHEN floor_sum(n, m, a, b) and self._floor_sum_naive(n, m, a, b) are called THEN the return values of the two methods match ''' value_max = 20 for n in range(1, value_max + 1): for m in range(1, value_max + 1): for a in range(value_max + 1): for b in range(value_max + 1): assert floor_sum(n, m, a, b) \ == self._floor_sum_naive(n, m, a, b)
def main(): t = list(map(int, input().strip().split()))[0] for _ in range(t): n, m, a, b = list(map(int, input().strip().split())) print(floor_sum(n, m, a, b))
def main() -> None: t = int(sys.stdin.readline()) for _ in range(t): n, m, a, b = map(int, sys.stdin.readline().split()) print(floor_sum(n, m, a, b))