/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Wrong Answer 14ms 3.094 MiB
#2 Wrong Answer 15ms 3.125 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
2024-11-11 03:46:51
Judged By
Score
0
Total Time
15ms
Peak Memory
3.125 MiB