1082 Shooting Match PAT (Basic Level)

Posted on

Topic link:



This is a typical topic that gives the number and score and then outputs the highest and lowest score, but the score is calculated by X and y.

I use character array to store the number of athletes, which is universal, but this question guarantees that the number is 4 digits, so I can also use integer variables to save, but we should consider the form of% 04D when output.

If you use character arrays, you need to consider that there may be redundant blank characters between the input string and the input integer, which can be filtered through%*c.

According to the distance formula between two points in the plane, R can be obtained.2=x2+y2Considering R2The size relation can represent the size relation of r, so calculate R directly.2Avoid using sqrt () functions.

AC Code:

 int main(void)
     int n=0,x=0,y=0,min=88888,max=-1;
     char s[8]="",s1[8]="",s2[8]="";
     printf("%s %s",s1,s2);
     return 0;


Leave a Reply

Your email address will not be published.