Scatter Point Plot

1000ms    65536K
38    14
Easier

Description

This problem deals with generating a plot of points that fit on the display screen. The Y axis is vertical and contains 20 lines (one Y value for each row); the X axis is horizontal and contains 12 positions (each X value takes 5 columns).

Input

1st line 		 low X value and X axis increment 
2nd line 		 low Y value and Y axis increment
		 Followed by one X value and one Y value per line.
		  They will be positive integers up to 4 digits.

Output

Using the output file, character display a X,Y plot including grid lines and axis labelling as shown in the sample 
below. Print Y-values right-justified in a field of width 5 ans `:`in column number six.

All pairs of X, Y values will be inputted and the lowest and highest needs to be found to determine scaling values. The increment for each row or column will be based on 20 positions for the Y axis and 12 for the X axis. When establishing what position a value will fall on rounding is to be done up at the halfway point to the next increment value.

If only one X, Y value falls at a particular point display the character 1. If two X, Y values fall at a particular point display the character 2; if three X, Y values fall at a particular point display the character 3; etc.

In case that there were ten or more X, Y values falling at a point, the numbers have to be centered on the cross-marks in the following way:

1000 100 10 1 ...+----+----+...

Sample Input

100 50
0 5
100,20
101,22
100,23
100,0
100,3
649,0
649,3
647,2
500,85
206,21
325,43
612,8
129,19
501,83

Sample Output

   95:                                                            
   90:                                                            
   85:                                            2               
   80:                                                            
   75:                                                            
   70:                                                            
   65:                                                            
   60:                                                            
   55:                                                            
   50:                                                            
   45:                             1                              
   40:                                                            
   35:                                                            
   30:                                                            
   25:    1                                                       
   20:    2    1    1                                             
   15:                                                            
   10:                                                      1     
    5:    1                                                      1
    0:    1                                                      2
     +----+----+----+----+----+----+----+----+----+----+----+----+
         100  150  200  250  300  350  400  450  500  550  600  650

Source

Editor

on 2006-10-02 20:01:50


North University of China

OnlineJudge

NUC

NOJ

OJ

ACM/ICPC