QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#635947#7033. Resistors in ParallelpskkkCompile Error//C++23531b2024-10-12 21:33:362024-10-12 21:33:37

Judging History

This is the latest submission verdict.

  • [2024-10-12 21:33:37]
  • Judged
  • [2024-10-12 21:33:36]
  • Submitted

answer

import math
def get_primes(N):
	primes = []
	least_prime = list(range(0, N + 1))
	for i in range(2, N + 1):
		if least_prime[i] == i:
			primes.append(i)
		for p in primes:
			if p * i > N:
				break
			least_prime[p * i] = p
			if i % p == 0:
				break
	return primes

ps=get_primes(100000)
T = int(input())
for x in range(T):
	n = int(input())
	a, b, x = 1, 1, 1
	for p in ps:
		if x * p > n:
			break
		x *= p
		a *= p + 1
		b *= p
		g = math.gcd(a, b)
		a //= g
		b //= g
	print("%d/%d" % (b, a))

Details

answer.code:1:1: error: ‘import’ does not name a type
    1 | import math
      | ^~~~~~
answer.code:1:1: note: C++20 ‘import’ only available with ‘-fmodules-ts’, which is not yet enabled with ‘-std=c++20’