Mathematical and Physical Journal
for High Schools
Issued by the MATFUND Foundation
 Already signed up? New to KöMaL?

# Problem I. 229. (January 2010)

I. 229. Besides conventional guns, their electronic versions are also used in sport shooting trainings. In these simulations, the targets are placed on screens, and coordinates of shots are stored and evaluated electronically.

Initially, coordinates of the middle of the target (cx,cy) are stored, then -- in the same coordinate system -- horizontal and vertical coordinates of each shot (lx,ly) are recorded. The score for the shot is determined by its distance from the centre:

-- First, differences of the corresponding coordinates x=lx-cx and y=ly-cy are formed.

-- If the center of the target is hit, the shot is worth the maximum 10 points. If this is not the case, the score is decreased according to the formula .

-- If this number is negative, then the score is zero.

-- The score is finally rounded to two decimals.

The first line of the file lolap.txt (downloadable from here) contains the number of shots N (3N500), while the second line contains coordinates of the center of the target cx, cy (25.00cx,cy75.00). The following N lines then store coordinates of consecutive shots lx, ly (0.00lx,ly100.00).

 65 28.95 31.60 23.67 30.18 35.12 50.27 30.45 34.67 ...

Numbers is in example should be interpreted as follows:

-- 65 shots are evaluated

-- the centre of the target is located at (28.95,31.60)

-- the first shot has x=23.67-28.95=-5.28 and y=30.18-31.60=-1.42 values, therefore the corresponding score rounded to 2 digits is 4.53

-- the second shot has score 0.

Your program loveszet should solve the following tasks. If a task requires screen output, display the number of that task as well (e.g., Task #3: ). Scores for shots should be rounded to 2 decimal digits, no other digits should be visible.

1. Read the file lolap.txt and use that information to solve the following questions. (If, for some reasons, the file can not be read, enter 10 lines manually and use that data in the following.)

2. Print the number and score of the highest shot.

3. To measure the quality of aiming at the target, list the number of shots with 0 score.

4.Determine which 10 consecutive shots have the highest average score. Display the number of the first shot of such a group.

5. Shots of a shooter may tend to be biased in a certain direction. By neglecting shots with 0 score, your program should display the number of shots in each quadrant, in a format similar to the following: 1st quadrant: 13 shot(s), 2nd quadrant: 18 shot(s), ... (The first quadrant consists of points with nonnegative coordinates. The third quadrant has points with both coordinates strictly negative. The rest of the points in the upper left and lower right part of the coordinate system form the second and fourth quadrants, respectively.)

6. Decide whether there have been 4 consecutive shots hitting the four quadrants in increasing order.

7. Ask the user to enter a score, then compute the length of the longest run of shots with scores greater than or equal to the given number.

The source code (i229.pas, i229.cpp, ...) together with a short documentation (i229.txt, i229.pdf, ...) -- also describing which developer environment to use for compiling, further a brief description of your solution -- should be submitted in a compressed file (i229.zip).

(10 pont)

Deadline expired on February 10, 2010.

Sorry, the solution is available only in Hungarian. Google translation

Megoldásokról

Összességében a beküldött megoldások jól sikerültek. A feladat könnyűnek mutatkozott. A pontvesztések oka első sorban a figyelmetlenségből következő hiányosságok voltak. Többen az 5. alfeladat megoldásában tévedtek. Nem értelmezték precízen, hogy "a nem 0 körértékű találatok közül" kellett megszámolni az egyes síknegyedekbe eső találatokat. Ketten részfeladat megoldását felejtették ki, illetve a síknegyed meghatározásánál a relációs jeleket tévesztették el.

Mintamegoldás

Barta János (Salgótarján, Madách Imre Gimnázium 10. osztály) megoldását közöljük: i229.pas

### Statistics:

 10 students sent a solution. 10 points: Balla Attila, Barta 111 János, Szabó 928 Attila. 9 points: Horváth 135 Loránd, Janosov Milán, Nagy 111 Miklós, Pap 999 Dávid. 8 points: 2 students. 7 points: 1 student.

Problems in Information Technology of KöMaL, January 2010