| ||||||||||
| 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 | |||||||||
为何Runtime Error啊?我想了半天也没想通#include<iostream.h>
int main()
{
const int maxn = 16;
int a[maxn][3];
long i,j,k,x,y,z,l;
for (i = 1; i <= maxn; i++) cin>>a[i][1]>>a[i][2]>>a[i][3];
cin>>x>>y>>z;
while (x >= 0)
{
k = 2147483647; l = 0;
for (i = 1; i <= maxn; i++)
{
j = (a[i][1] - x) * (a[i][1] - x) + (a[i][2] - y) * (a[i][2] - y)
+ (a[i][3] - z) * (a[i][3] - z);
if (j < k)
{
l = i; k = j;
}
}
cout<<'('<<x<<','<<y<<','<<z<<") maps to (";
cout<<a[l][1]<<','<<a[l][2]<<','<<a[l][3]<<')'<<endl;
cin>>x>>y>>z;
}
return 0;
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator