91932024-02-17 21:18:35NagyLeoA sárkány feladványa (50)python3Accepted 50/5034ms13440 KiB
from math import gcd


def main():
    for _ in range(3):
        a = False
        A, B, N = map(int, input().split())
        for i in range(10 ** (N - 1), 10 ** (N)):
            if i % A == 0 and i % B == 0:
                print(i)
                a = True
                break
        if not a:
            print("-1")


def main2():
    for _ in range(3):
        a = False
        A, B, N = map(int, input().split())
        lcm = abs(A * B) // gcd(A, B)

        if lcm > 10 ** N:
            print("-1")
            continue
        while True:
            if len(str(lcm)) == N:
                break
            lcm *= 10
        print(lcm)


main2()
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/017ms11432 KiB
2Accepted0/018ms11520 KiB
3Accepted3/317ms11644 KiB
4Accepted3/317ms12144 KiB
5Accepted3/318ms12348 KiB
6Accepted3/317ms12692 KiB
7Accepted3/318ms12740 KiB
8Accepted3/317ms12876 KiB
9Accepted3/317ms13112 KiB
10Accepted3/318ms13040 KiB
11Accepted3/317ms13424 KiB
12Accepted3/317ms13372 KiB
13Accepted4/425ms13316 KiB
14Accepted4/419ms13424 KiB
15Accepted4/426ms13344 KiB
16Accepted4/428ms13440 KiB
17Accepted4/434ms13200 KiB