The following program is my ACcepted code for NTHU-7488.
It's a for everybody to learn and discuss.
If there is any mistake or comment, please let me know. :D
此乃NTHU 7488 的AC code!
歡迎一同討論學習,如有錯誤與任何建議請留言 : )
點這裡看題目 Click here to see this Problem!
我認為也可使用暴力單純一個個搜尋 (時間限制是10秒)
但是我是使用map的簡單應用AC
我之前習慣使用 (m[tmpStr] != 0) 來代表之前沒有存入 map 中的 key 值
但可能因為 map 之前沒有 access 過這個key值,所以 NTHU OJ把這種狀況視為 Runtime Error(SIGABRT).
改成 if(m.count(tmpStr) > 0) 即可AC
I think using brute force to search the key is still fine. (time limit: 10 s)
But I use simple STL map to solve it.
I used to apply (m[tmpStr] != 0) to represent the key, which was not saved in map.
But maybe map didn't access this key value so NTHU OJ think that's Runtime Error(SIGABRT).
I modifed it to if(m.count(tmpStr) > 0) and got AC.