QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#745944#8250. Magnesium Supplementationt-aswathWA 10ms10836kbPython3634b2024-11-14 12:34:362024-11-14 12:34:38

Judging History

你现在查看的是最新测评结果

  • [2024-11-14 12:34:38]
  • 评测
  • 测评结果:WA
  • 用时:10ms
  • 内存:10836kb
  • [2024-11-14 12:34:36]
  • 提交

answer

import math


def solve():
    n, k, p = map(int, input().strip().split())
    l, r = 1, k
    while l < r:
        m = (l + r) // 2
        if (m * p) > n:
            r = m
        else:
            l = m + 1
    divisors = set()
    for i in range(1, int(math.sqrt(n)) + 2):
        if n % i == 0:
            divisors.add(i)
            divisors.add(n // i)
    ans = []
    for i in divisors:
        if i >= l and i <= min(n, k):
            ans.append(i)
    print(len(ans))
    for i in ans:
        print(i, end=" ")


if __name__ == "__main__":
    t = 1
    for i in range(t):
        solve()

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 10ms
memory: 10836kb

input:

6 6 4

output:

3
2 3 6 

result:

wrong answer 2nd lines differ - expected: '2', found: '2 3 6 '