QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#276326#7033. Resistors in Parallelzzuqy#RE 15ms9220kbPython3722b2023-12-05 19:55:432023-12-05 19:55:44

Judging History

This is the latest submission verdict.

  • [2023-12-05 19:55:44]
  • Judged
  • Verdict: RE
  • Time: 15ms
  • Memory: 9220kb
  • [2023-12-05 19:55:43]
  • Submitted

answer

primes = [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199]
T = int(input())

def gcd(x, y):
  if y == 0:
      return x
  return gcd(y, x % y)

for i in range(T):
  n = int(input())
  p = 1
  q = 1
  res = 1
  i = 0
  while res * primes[i] <= n:
    # print(primes[i])
    res = res * primes[i]
    p = p * primes[i]
    q = q * (1 + primes[i])
    i = i + 1  
  # print(p)
  # for j in range(i):
  #   q = q + p // primes[j]
  g = gcd(p, q)
  p = p // g
  q = q // g
  print("{}/{}".format(p, q))
  
  # 3 + 2 + 1 
  # 1/2 + 1/3 + 1/6

  # #
  # 3*5 + 2*5 + 2*3
  # 1/2 + 1/3 + 1/5

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 15ms
memory: 9088kb

input:

3
10
100
1000

output:

1/2
5/12
35/96

result:

ok 3 lines

Test #2:

score: 0
Accepted
time: 11ms
memory: 9220kb

input:

100
9055
764034929998350
175478445981
3066144
373717
79921483664325743
31787974933
19712134724867403
86665280597
9459527960934
45840
6831794283
631941163719
8241229170655
992693590670671467
288745916793799209
83790620689711
21805764718032208
5455
39
909
3
79423683
43
198853556983437047
5221603522064...

output:

385/1152
76253198879/321052999680
30808063/119439360
12155/41472
715/2304
298080686527/1284211998720
30808063/119439360
298080686527/1284211998720
30808063/119439360
1859834119/7644119040
715/2304
30808063/119439360
955049953/3822059520
1859834119/7644119040
14009792266769/61642175938560
29808068652...

result:

ok 100 lines

Test #3:

score: -100
Dangerous Syscalls

input:

100
179305586963
96883378626478880429056246520023290774722301848230232935789122
161758308595898
178124354133226622987953243895918403851
1893414732443742551436
61239961784411409687653066831224920774024514762604245
2305567963945518424753102147331756069
619035744750559608675
8749921888120
4072968059924...

output:

30808063/119439360
1749936537208721528520879643954955339690231858377/9753327077118246544899138751790948391321600000000
1859834119/7644119040
2694014995838881344684929537/13636826284246500397547520000
742518990138757/3328677500682240
47269280380971678953725754621107734221741/2546294662990352585865481...

result: