Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
为什么会CE 说sqrt错了#include<cstdio> #include<cmath> #include<cstring> #include<cstdlib> #include<algorithm> #include<queue> #include<stack> using namespace std; int main() { #define maxn 16 int a[20],b[20],c[20],x,y,z,minsign; double ans,minpoint; for(int i=1;i<=maxn;i++) { scanf("%d%d%d\n",&a[i],&b[i],&c[i]); } while(scanf("%d%d%d\n",&x,&y,&z),x!=-1) { minpoint=9999999; for(int i=1;i<=maxn;i++) { ans=sqrt((a[i]-x)*(a[i]-x)+(b[i]-y)*(b[i]-y)+(c[i]-z)*(c[i]-z)); if(ans<minpoint) { minpoint=ans; minsign=i; } } printf("(%d,%d,%d) maps to (%d,%d,%d)\n",x,y,z,a[minsign],b[minsign],c[minsign]); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator