TopCoder

User's AC Ratio

100.0% (2/2)

Submission's AC Ratio

66.7% (2/3)

Tags

Description

可視化方程式是個對於理解解析幾何頗有幫助的工具,今天大明想要做個工具來輔助他判斷他畫的方程式圖形是否正確,能請你幫他寫個程式幫幫他嗎?
要完成的程式需求如下:
對於一個二元二次不等式 $ax^ 2 + bxy + cy^ 2 + dx +ey \ge f$ 把 $(0,0)$ 到 $(n,m)$ 中滿足不等式的整數點($x,y$ 值皆為整數的點)標上 * 號,不滿足的點留下空白。

注意:本題的 $x$ 軸正向朝右邊,$y$ 軸正向朝上,也就是 $(0,0)$ 會在左下角,$(n,m)$ 會在右上角。

範例測資解釋

image

這題的範例輸出因顯示問題無法正確顯示,下方為範例測資的正確輸出:

*****
*****
*****
*****
 ****
  ***
  ***
  ***
   **
               ***********
               ***********
               ***********
               ***********
               ***********
               ***********
                **********
                **********
                 *********
                  ********
                    ******



*******                   
*********                 
**********                
***********               
***********               
************              
************              
************              
************              
************              
************              
************              

Input Format

第一行有兩個正整數 $n,m$ 代表要計算的範圍。
第二行有六個整數 $a,b,c,d,e,f$ 代表要計算的不等式為 $ax^ 2 + bxy + cy^ 2 + dx + ey \ge f$。

  • $1 \le n,m \le 100$
  • $-1000 \le a,b,c,d,e,f \le 1000$

Output Format

一個大小為 $(n+1)\times (m+1)$,由 * 和空白組成的矩形,* 代表該點滿足不等式,空白代表該點不滿足。

Sample Input 1

4 8
1 0 0 0 1 5

Sample Output 1

*****
*****
*****
*****
****
***
***
***
**

Sample Input 2

25 25
0 1 0 -13 -13 -155

Sample Output 2

***********
***********
***********
***********
***********
***********
**********
**********
*********
********
******



*******
*********
**********
***********
***********
************
************
************
************
************
************
************

Hints

Problem Source

Subtasks

No. Testdata Range Constraints Score
1 0~1 範例測資 0
2 0~11 無額外限制 100

Testdata and Limits

No. Time Limit (ms) Memory Limit (VSS, KiB) Output Limit (KiB) Subtasks
0 1000 524288 65536 1 2
1 1000 524288 65536 1 2
2 1000 524288 65536 2
3 1000 524288 65536 2
4 1000 524288 65536 2
5 1000 524288 65536 2
6 1000 524288 65536 2
7 1000 524288 65536 2
8 1000 524288 65536 2
9 1000 524288 65536 2
10 1000 524288 65536 2
11 1000 524288 65536 2