Re: [問題] 奇怪的現象?-同份code, C++能過,C不能過
descent@debianlinux:~$ gcc a.c
/tmp/ccMohpQp.o: In function `Reduce':
a.c:(.text+0x5e): undefined reference to `log2'
a.c:(.text+0x66): undefined reference to `ceill'
a.c:(.text+0x7e): undefined reference to `pow'
collect2: ld returned 1 exit status
descent@debianlinux:~$ gcc a.c -lm
加上 -lm 可以過, 不過用 g++ 不用加 -lm
-rwxr-xr-x 1 descent descent 6366 May 14 21:32 a
-rwxr-xr-x 1 descent descent 6378 May 14 21:32 a.cpp
在我的機器上檔案的確不同。c++ 版本大了一點。
※ 引述《BombCat (炸彈貓)》之銘言:
: 開發平台(Platform): (Ex: VC++, GCC, Linux, ...)
: ZeroJudge online judgement
: 額外使用到的函數庫(Library Used): (Ex: OpenGL, ...)
: 問題(Question):
: d923. 規律 http://zerojudge.tw/ShowProblem?problemid=d923
: 大致做法就是把區域切成四大塊,每一塊增加的值都是可以算先好的
: 所以不必每格都算過,遞迴一直切下去。
: 但卻發生奇怪的現象...
: 同份code, C++能過,C不能過
: 原本我猜是型態傳換的問題
: 後來全部換成 unsigned long long int 還是一樣C過不了 (大哭
: 有人可以告訴我為什麼嗎?
: 餵入的資料(Input):
: 預期的正確結果(Expected Output):
: 錯誤結果(Wrong Output):
: 程式碼(Code):(請善用置底文網頁, 記得排版)
: http://ideone.com/E3WZ7
: 補充說明(Supplement):
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 58.114.133.24
※ 編輯: descent 來自: 58.114.133.24 (05/14 21:34)
→
05/15 05:11, , 1F
05/15 05:11, 1F
→
05/15 05:11, , 2F
05/15 05:11, 2F
→
05/15 05:16, , 3F
05/15 05:16, 3F
推
05/15 05:19, , 4F
05/15 05:19, 4F
→
05/15 13:17, , 5F
05/15 13:17, 5F
→
05/15 13:18, , 6F
05/15 13:18, 6F
→
05/15 13:18, , 7F
05/15 13:18, 7F
討論串 (同標題文章)
本文引述了以下文章的的內容:
完整討論串 (本文為第 2 之 2 篇):