最后一个WA了

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

ASOUL_Official @ 2020-07-25 22:30:05

记录

#include<iostream>
#include<iomanip> //setpricision
#include<cmath>
#include<cstring>
#include<algorithm>
using namespace std;
int main(){
    int x1,x2,x3,y1,y2,y3;
    float dist;
    cin>>x1>>y1>>x2>>y2>>x3>>y3;
    dist=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2))+sqrt((x2-x3)*(x2-x3)+(y2-y3)*(y2-y3))+sqrt((x1-x3)*(x1-x3)+(y1-y3)*(y1-y3));
    cout<<setprecision(2)<<fixed<<dist<<endl;
    return 0;
}
PS D:\NOIP\日常练习> cd "d:\NOIP\日常练习\" ; if ($?) { g++ 洛谷P5735.cpp -o 洛谷P5735 } ; if ($?) { .\洛谷P5735 }
23.234 12.123
nan

by 云浅知处 @ 2020-07-25 22:31:58

@lancdn 是fixed<<setprecision(2)吧,好像fixed在前面?


by ASOUL_Official @ 2020-07-26 19:37:42

@云浅知处 fixed换位置了,不好使(((


|