Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

为何Runtime Error啊?我想了半天也没想通

Posted by jimmyzzxhlh1 at 2005-01-03 15:10:04 on Problem 1046
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator