m******3 发帖数: 346 | 1 贴个leetcode讨论区的解答,思想就是一边生成一边计算
void addOperators(vector& result, string nums, string t, long long
last, long long curVal, int target) {
if (nums.length() == 0) {
if (curVal == target)
result.push_back(t);
return;
}
for (int i = 1; i<=nums.length(); i++) {
string num = nums.substr(0, i);
if(num.length() > 1 && num[0] == '0')
return;
string nextNum = nums.substr(i);
if (t.length() > 0) {
addOpera... 阅读全帖 |
|
l******6 发帖数: 340 | 2 3.
struct data{
int idx;
int val;
data(int id , int v):idx(id),val(v){}
};
int wlen = 100M;
int curVal;
int curIdx = 0;
list window;
while(cin >> curVal)
{
while(!window.empty() && window.back().val <= curVal)
window.pop_back();
window.push_back(data(curIdx , curVal));
curIdx ++;
if(curIdx - window.front().idx > wlen)
window.pop_front();
cout << window.front().val<
} |
|
j*****n 发帖数: 23 | 3 #include
#include
#include
#include
#include
#include
#include
using namespace std; //这个最好解释一下不会真的在production上这么写
void jf_eval(string& in_line, unordered_map
//jf 是什么意思?
>>& record)
{
int i_dex = in_line.find_first_of(' ');
string cur_var = in_line.substr(0, i_dex);
vector varibles;
int cur_value = 0, ele = 0;
bool new_variable = true, new_number = true; int ... 阅读全帖 |
|
f********t 发帖数: 117 | 4 either using return id after insert.
select curval ('seq name') |
|