[BOJ 11298] Graphs

View as PDF

Submit solution

Points: 2
Time limit: 1.0s
Memory limit: 256M

Problem types
Allowed languages
Assembly, Awk, C, C++, Java, Pascal, Perl, Python, Sed, Text

Miss Fotheringale is teaching her maths class about plotting graphs. As a first exercise, she wants them to plot a linear graph y = ax + b for values of x from 0 to 10 inclusive.</p>

She wants you to help by writing a program that outputs the correct answers to make it easier for her to mark her pupils' work.

입력 형식

The first line of input is a single number N, 0 < N < 30, a positive integer that tells the number of graphs to be plotted.</p>

N lines then follow, each representing one graph to be plotted. Each line contains 2 non-negative integers, A and B, 0 <= A, B <10, being the values of a and b for the graph. A and B will not both be 0.

출력 형식

For each graph, firstly output the equation being plotted on a line by itself. Under this must be the graph. All points on the axes, plus points on the graph must be represented by the * character. The x axis must contain the points 0 to 10 from left to right, the y axis the points 0 to the maximum value from bottom to top.

예제 입력

2
1 0
2 2

예제 출력

y = 1x + 0
*         *
*        * 
*       *  
*      *   
*     *    
*    *     
*   *      
*  *       
* *        
**         
***********
y = 2x + 2
*         *
*          
*        * 
*          
*       *  
*          
*      *   
*          
*     *    
*          
*    *     
*          
*   *      
*          
*  *       
*          
* *        
*          
**         
*          
*          
*          
***********

Comments

There are no comments at the moment.