[問題] UVA272-Time limit exceeded 求解
各位大大好
這題的大意主要是 改變 文字中的雙引號
input ->
"To be or not to be," quoth the Bard, "that
is the question".
output->
``To be or not to be," quoth the Bard, "that
is the question''.
我的code如下:
http://codepad.org/AYeQu33e
想不太出來 效率可能會慢在哪裡QQ
應該不會是本身string提供的member function ( find , replace...)很慢吧?
我知道我可以用檢查的字元方式 再去跑for迴圈檢查 來替換
但還是想知道到底 問題在哪呢QQ
感謝 :)
ps: 會有兩個 if的檢查式 是因為 uva的測資 有一些會有單一個引號的問題
這樣會造成 runtime error 所以才加了第二個
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 1.171.16.131
※ 文章網址: https://www.ptt.cc/bbs/C_and_CPP/M.1438600046.A.6DC.html
→
08/03 19:22, , 1F
08/03 19:22, 1F
→
08/03 19:27, , 2F
08/03 19:27, 2F
→
08/03 19:32, , 3F
08/03 19:32, 3F
→
08/03 22:45, , 4F
08/03 22:45, 4F
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章