import sys sys.setrecursionlimit(1000000000) # # Solution Template for Mixed Fraction # # This file is provided to assist with reading and writing of the input # files for the problem. You may modify this file however you wish, or # you may choose not to use this file at all. # # Open the input and output files. input_file = open("mixin.txt", "r") output_file = open("mixout.txt", "w") n = None d = None # Read the values from the input file. input_line = input_file.readline().strip() n, d = map(int, input_line.split()) # TODO: This is where you should compute the answer and store them it the # variables a and b. a = None b = None # Write the answer to the output file. if b != 0: output_file.write("%d %d/%d\n" % (a, b, d)) else: output_file.write("%d\n" % (a)) # Finally, close the input/output files. input_file.close() output_file.close()