Sort by

recency

|

500 Discussions

|

  • + 0 comments

    It’s nearly impossible to find knowledgeable individuals on this topic, and you seem like there’s more you’re preaching about! Thanks Daftar Domino88

  • + 0 comments

    I would like the information posts, Help make appreciated, I might favor far more details applying this, considering it is very desirable., Bless an individual made for creating. domino88 link resmi

  • + 0 comments

    That's an interesting problem! It feels like there should be a clever math trick to solve this efficiently, avoiding brute-force looping. I'd probably start by calculating ab, then finding the two multiples of x that bracket it. Then a simple comparison to see which is closer. It reminds me of some of the fun puzzles I enjoy in games. Speaking of which, sometimes when I need a mental break, I mess around with something completely different like Solar Smash and just destroy planets. Great problem though!

  • + 0 comments

    import sys import math

    def closest_multiple(a, b, x): value = a ** b # this will be a float if b is negative div = value / x

    lower = math.floor(div)
    upper = lower + 1
    
    lower_mult = lower * x
    upper_mult = upper * x
    
    diff_lower = abs(value - lower_mult)
    diff_upper = abs(value - upper_mult)
    
    if diff_lower < diff_upper:
        return round(lower_mult)
    elif diff_lower > diff_upper:
        return round(upper_mult)
    else:
        return round(min(lower_mult, upper_mult))  # tie case
    

    Fast input reading

    def main(): input = sys.stdin.read data = input().split()

    T = int(data[0])
    idx = 1
    results = []
    
    for _ in range(T):
        a = int(data[idx])
        b = int(data[idx + 1])
        x = int(data[idx + 2])
        idx += 3
    
        res = closest_multiple(a, b, x)
        results.append(str(res))
    
    print("\n".join(results))
    

    main()

  • + 0 comments

    https://vegasinsider.co.uk/ Vegas insider uk betting platf