Home > Back-end >  Contest questions how to solve
Contest questions how to solve

Time:03-09

Why didn't pass, the x and y are horizontal ordinate values, changed to SQRT (x * * y x + y) or not by

CodePudding user response:

Every time before input, need to put the sum,
 
While (1)
{
Sum=0;
The scanf (" % d ", & amp; N);
//after the code is the same with you
}

CodePudding user response:

Wipe, write wrong, should be the Max reset

 
While (1)
{
Max=0;
The scanf (" % d ", & amp; N);
//after the code is the same with you
}

CodePudding user response:

In the for loop before or after the cycle of Max clear operation is no problem, if not zero, then the last calculated Max could affect to the next set of results

CodePudding user response:

Reference:
 # include & lt; Math. H> 
#include
# define N 50
# define M 2

Int main (int arg c, char * argv [])
{
Int I, j, h, n;
Float Max=0;

Float score [N] [M]={0}, a_space [N]={0};

Printf (" please enter the number of athletes: ");

While (1)
{
The scanf (" % d ", & amp; N);
If (n==0) break;

for(i=0; ifor(j=0; JThe scanf (" % f ", & amp; Score [I] [j]);

for(i=0; i{
for(j=0; JA_space [I] +=score score [I] [j] * [I] [j];
A_space [I]=SQRT (a_space [I]);
}

Max=a_space [0].
for(i=0; i{

If (max{
Max=a_space [I];
H=I + 1;
}
}
Printf (" champion is NO. # % d, grades=% f \ n ", h, Max).
}
return 0;
}

CodePudding user response:

According to the question, the words of this definition:
 # define N 100 

CodePudding user response:

refer to the second floor Minikinfish response:
brush, write wrong, should be the Max reset

 
While (1)
{
Max=0;
The scanf (" % d ", & amp; N);
//after the code is the same with you
}

Brother, I solved, when I was just released Max inside the loop defined directly by the but still thank you

CodePudding user response:

The
reference 4 floor QZJHJXJ reply:
for reference:
 # include & lt; Math. H> 
#include
# define N 50
# define M 2

Int main (int arg c, char * argv [])
{
Int I, j, h, n;
Float Max=0;

Float score [N] [M]={0}, a_space [N]={0};

Printf (" please enter the number of athletes: ");

While (1)
{
The scanf (" % d ", & amp; N);
If (n==0) break;

for(i=0; ifor(j=0; JThe scanf (" % f ", & amp; Score [I] [j]);

for(i=0; i{
for(j=0; JA_space [I] +=score score [I] [j] * [I] [j];
A_space [I]=SQRT (a_space [I]);
}

Max=a_space [0].
for(i=0; i{

If (max{
Max=a_space [I];
H=I + 1;
}
}
Printf (" champion is NO. # % d, grades=% f \ n ", h, Max).
}
return 0;
}

I write, but still very thank you
  • Related