P1888 题解

三角函数余弦值,说实话之前还没学过这玩意,百度了一下,用Python3水过了。

代码如下(Python3):

import math

abc = input().split(' ')
for x in range(0, 3):
    abc[x] = int(abc[x])
abc.sort()

a = abc[0]
b = abc[1]
c = abc[2]

gcdx = math.gcd(a, c)

ax = a // gcdx
cx = c // gcdx

result = "%s/%s" % (str(ax), str(cx))

print(result)

偷懒,gcd直接用的库函数:)

原文地址:https://www.cnblogs.com/kozumi/p/12991169.html