Description Questions
define a structure of the type represented by three-dimensional coordinates, integer values for three-dimensional coordinate point is stored.
In the main function, the input three-dimensional coordinates of the N points (the XYZ), and stored in the array structure. Please find them among the largest z-axis coordinate points, and the output value of the three-dimensional coordinates of the point.
To simplify, assume that the maximum z axis coordinate of the point is unique.
Input
Input contains N + 1 rows:
the first row is a positive integer N (0 <N <1000) .
The second row to row 1 + N, each line has three integers, XYZ three-dimensional coordinate values of a point. Near two numbers separated by a space.
Output
the output values of the z-axis coordinate of the three-dimensional coordinates of the maximum point. Near two numbers separated by a space.
Input example
. 3
. 17 200 is -50
-72 66 55
9172100
output exemplary
9172100
data range
of input and output are integers int range to 100% of the data, 0 <N <1000
#include <stdio.h>
struct loc
{
int x;
int y;
int z;
}s[1000][3];
void main()
{
int N,i,j,h,max;
scanf("%d",&N);
for(i=0;i<N;i++)
scanf("%d %d %d",&s[i][0].x,&s[i][1].y,&s[i][2].z);
max=s[0][2].z;
h=0;
for(i=1;i<N;i++)
{
if(s[i][2].z>max)
{
max=s[i][2].z;
h=i;
}
}
printf("%d %d %d",s[h][0].x,s[h][1].y,s[h][2].z);
}