python,vscode上过,但提交时……

P5735 【深基7.例1】距离函数

EC75 @ 2021-12-05 19:57:42

from math import*
def dis(a, b, c, d):
    return sqrt((a-b)**2+(c-d)**2)
def main():
    x1,y1=map(int,input().split())
    x2,y2=map(int,input().split())
    x3,y3=map(int,input().split())
    print("{:.2f}".format((int(dis(x1,x2,y1,y2)+dis(x1,x3,y1,y3)+dis(x2,x3,y2,y3)))))
main()

by yuchenren @ 2021-12-05 20:01:38

你这玩意都输出 0 了(


by sycqwq @ 2021-12-05 20:08:24

@continue_and_break 把int去掉能拿80分,还有一个re

你int会让他直接去尾


by EC75 @ 2021-12-05 20:10:54

@无敌的蒟蒻 然后——


by sycqwq @ 2021-12-05 20:15:25

@continue_and_break 然后re,我不会用Python


by EC75 @ 2021-12-05 20:19:15

@无敌的蒟蒻 3_2_1!

x1,y1=map(float,input().split())
x2,y2=map(float,input().split())
x3,y3=map(float,input().split())
d1=((x1-x2)**2+(y1-y2)**2)**0.5
d2=((x1-x3)**2+(y1-y3)**2)**0.5
d3=((x3-x2)**2+(y3-y2)**2)**0.5
print("%.2f"%(d1+d2+d3))

AC


by EC75 @ 2021-12-05 20:19:43

放弃用自定义


by Terrible @ 2021-12-05 20:37:11

print("{:.2f}".format((int(dis(x1,x2,y1,y2)+dis(x1,x3,y1,y3)+dis(x2,x3,y2,y3)))))

这个int是哪里的要求?


by SeanTheSheep @ 2021-12-05 20:54:42

@continue_and_break 输入输出的时候都要用浮点数类型


|