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 |
为什么提交总是compile error 编译器里都正常#include<iostream> #include<math.h> using namespace std; int main() { int a[16][3],b[3]; for(int i=0;i<16;i++) cin>>a[i][0]>>a[i][1]>>a[i][2]; while(cin>>b[0]>>b[1]>>b[2],b[0]!=-1&&b[1]!=-1&&b[2]!=-1) { int c=0; float min=0.0,k=0.0; min=sqrt((a[0][0]-b[0])*(a[0][0]-b[0])+(a[0][1]-b[1])*(a[0][1]-b[1])+(a[0][2]-b[2])*(a[0][2]-b[2])); for(int i=1;i<16;i++) { k=sqrt((a[i][0]-b[0])*(a[i][0]-b[0])+(a[i][1]-b[1])*(a[i][1]-b[1])+(a[i][2]-b[2])*(a[i][2]-b[2])); if(min>k) {min=k;c=i;} } printf("(%d,%d,%d) maps to (%d,%d,%d)\n",b[0],b[1],b[2],a[c][0],a[c][1],a[c][2]); } //system("pause"); return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator