[問題] UVA 621 RUNTIME ERROR

看板C_and_CPP作者 (Diastima)時間2年前 (2021/08/07 23:28), 2年前編輯推噓2(205)
留言7則, 5人參與, 2年前最新討論串1/1
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

08/07 23:37, 2年前 , 1F
這錯字也太多了把==
08/07 23:37, 1F

08/07 23:41, 2年前 , 2F
再貼碼的時候跑掉,重新貼,sorry
08/07 23:41, 2F
※ 編輯: Diastima (101.9.133.16 臺灣), 08/07/2021 23:42:36

08/08 00:00, 2年前 , 3F
會不會是 stoi overflow?
08/08 00:00, 3F

08/08 00:02, 2年前 , 4F
感覺是,光是他udebug給的input就一堆會出問題了
08/08 00:02, 4F

08/08 20:57, 2年前 , 5F
寫這種東西 我都用stod或stoll
08/08 20:57, 5F

08/08 22:15, 2年前 , 6F
這題我印象中轉數字一定爆...
08/08 22:15, 6F

08/08 22:16, 2年前 , 7F
不管轉整數或轉浮點數都一樣
08/08 22:16, 7F
文章代碼(AID): #1X3gQqDO (C_and_CPP)