作者Biboy (栗子)
看板C_and_CPP
標題[問題] ACM476 Wrong Answer
時間Sun Jan 8 23:19:00 2012
開發平台(Platform): (Ex: VC++, GCC, Linux, ...)
C++
額外使用到的函數庫(Library Used): (Ex: OpenGL, ...)
無
問題(Question):
自己測試的結果都正確
網站上提供的Sample結果也和我跑的一樣
不知道是漏考慮了哪點才造成WA
餵入的資料(Input):
r 8.5 17.0 25.5 -8.5
r 0.0 10.3 5.5 0.0
r 2.5 12.5 12.5 2.5
*
2.0 2.0
4.7 5.3
6.9 11.2
20.0 20.0
17.6 3.2
-5.2 -7.8
9999.9 9999.9
預期的正確結果(Expected Output):
Point 1 is contained in figure 2
Point 2 is contained in figure 2
Point 2 is contained in figure 3
Point 3 is contained in figure 3
Point 4 is not contained in any figure
Point 5 is contained in figure 1
Point 6 is not contained in any figure
錯誤結果(Wrong Output):
Point 1 is contained in figure 2
Point 2 is contained in figure 2
Point 2 is contained in figure 3
Point 3 is contained in figure 3
Point 4 is not contained in any figure
Point 5 is contained in figure 1
Point 6 is not contained in any figure
(和正確結果一樣)
程式碼(Code):(請善用置底文網頁, 記得排版)
http://codepad.org/m3rQGuln
補充說明(Supplement):
因為看過「矩形要可以超過10個」的文章
所以決定用linked list來儲存矩形
因為以前也沒用這招過,想說練習看看
所以程式碼稍微複雜一點...
我自己有手動測試,結果是都正確
但是上傳後卻都是WA
不知道是不是疏忽了哪類型的測資
麻煩前輩們幫忙一下~
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.111.129.82
→ mythnc:n <= 10 其實用2維陣列也ok 01/08 23:47
推 flere:不確定是否會有浮點數誤差耶,我都習慣會加上0.00000001 01/08 23:53
→ mythnc:66行 printf("\n"); 刪掉就AC 01/09 00:00
→ Biboy:感謝樓上的幫忙,原來是忘記刪掉那行! 我原本是打算用二維陣 01/09 08:33
→ Biboy:列來做,但是因為沒實做過linked list,剛好這題有機會用到 01/09 08:34
→ Biboy:所以就想用linked list來試試看! 01/09 08:35