看板 C_and_CPP 關於我們 聯絡資訊
UVA 621一直出現runtime error https://onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=8&pag 能否有神人能夠解惑,是出在哪個步驟 感謝 int main(void) { char str[10000]; int n; cin>>n; while(n--) { cin >> str; if (stoi(str) == 1 || stoi(str)== 4 || stoi(str)== 78) cout << "+\n"; else if (stoi(str)%100 == 35) cout << "-\n"; else if (str[0] == '9' && stoi(str)%10 == 4) cout << "*\n"; else if (str[0] == '1' && str[1] == '9' && str[2] == '0') cout << "?\n"; } return 0; } ----- Sent from JPTT on my OPPO CPH1917. -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 101.9.133.16 (臺灣) ※ 文章網址: https://www.ptt.cc/bbs/C_and_CPP/M.1628350132.A.358.html ※ 編輯: Diastima (101.9.133.16 臺灣), 08/07/2021 23:29:32
nh60211as: 這錯字也太多了把==08/07 23:37
Diastima: 再貼碼的時候跑掉,重新貼,sorry08/07 23:41
※ 編輯: Diastima (101.9.133.16 臺灣), 08/07/2021 23:42:36
NciscalA: 會不會是 stoi overflow? 08/08 00:00
nh60211as: 感覺是,光是他udebug給的input就一堆會出問題了 08/08 00:02
tomsawyer: 寫這種東西 我都用stod或stoll 08/08 20:57
LPH66: 這題我印象中轉數字一定爆... 08/08 22:15
LPH66: 不管轉整數或轉浮點數都一樣 08/08 22:16