/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Wrong Answer 13ms 2.777 MiB
#2 Wrong Answer 12ms 2.777 MiB
#3 Wrong Answer 13ms 2.805 MiB
#4 Wrong Answer 13ms 2.809 MiB
#5 Wrong Answer 13ms 2.887 MiB
#6 Wrong Answer 13ms 2.816 MiB
#7 Wrong Answer 13ms 2.891 MiB
#8 Wrong Answer 13ms 2.777 MiB
#9 Wrong Answer 13ms 2.895 MiB

Code


# Define a function to find the GCD of two numbers
def gcd(a, b):
  # If b is zero, return a
  if b == 0:
    return a
  # Otherwise, recursively call the function with b and the remainder of a/b
  else:
    return gcd(b, a % b)

# Define a function to calculate and print the percentage of achievement unlocked
def percentage(a, u):
  # Find the GCD of a and u
  g = gcd(a, u)
  # Simplify the fraction by dividing both by the GCD
  x = u // g
  y = a // g
  # Print the result in the format of x / y
  print(x, "/", y, sep="")

# Take the input of the number of games
G = int(input())

# Use a for loop to iterate over G times
for i in range(G):
  # Take the input of the number of achievements available and unlocked
  A, U = map(int, input().split())
  # Print the game number
  print("Game #{}: ".format(i + 1), end="")
  # Call the percentage function with A and U
  percentage(A, U)





Information

Submit By
Type
Submission
Problem
P1001 Achievement-Unlocked
Language
Python 3 (Python 3.12.3)
Submit At
2023-12-31 12:02:27
Judged At
2023-12-31 12:02:27
Judged By
Score
0
Total Time
13ms
Peak Memory
2.895 MiB