摘要: string multiply(string num1, string num2) { if (num1 == "0" || num2 == "0") return "0"; int sa = num1.size(); int sb = num2.size(); vector temp(sa + sb, 0); for (int i = sa - 1; i >= 0;... 阅读全文
posted @ 2016-03-08 21:07 HUSTLX 阅读(132) 评论(0) 推荐(0) 编辑
摘要: vector plusOne(vector& digits) { vector res; int carry = 1; for (int i = digits.size() - 1; i >= 0; i--) { int sum = carry + digits[i]; carry = sum / 10; res.push_back(su... 阅读全文
posted @ 2016-03-08 20:15 HUSTLX 阅读(143) 评论(0) 推荐(0) 编辑
摘要: #include #include #include #include #include using namespace std;string addBinary(string a, string b) { int carry = 0; int len = a.size() > b.size() ? a.size() : b.size(); string res; for ... 阅读全文
posted @ 2016-03-08 19:59 HUSTLX 阅读(167) 评论(0) 推荐(0) 编辑