本文整理汇总了C++中vll::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ vll::begin方法的具体用法?C++ vll::begin怎么用?C++ vll::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vll
的用法示例。
在下文中一共展示了vll::begin方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: all
void all( vll& v, vll& l )
{
for( int i = 0; i < v.size(); ++i )
{
vll tmp, comb;
for( vlli j = l.begin(); j != l.end(); ++j )
tmp.push_back( *j + v[ i ] );
for( vlli m = l.begin(), n = tmp.begin(); m != l.end() || n != tmp.end(); )
comb.push_back( n == tmp.end() || m != l.end() && *m <= *n? *m++ : *n++ );
l.swap( comb );
}
}
示例2: main
int main(){
ios_base::sync_with_stdio(false);
int T;
ll a, b;
cin >> T;
preprocess();
while(T--){
cin >> a >> b;
if(a == b){
cout << test(a) << '\n';
continue;
}
vll::iterator first = lower_bound(nums.begin(), nums.end(),a), last = lower_bound(nums.begin(), nums.end(),b);
cout << (int)(last - first) + (*last == b) << '\n';
}
}
示例3: karatsubaMultiply
static vll karatsubaMultiply(const vll &a, const vll &b) {
int n = a.size();
vll res(n + n);
if (n <= 32) {
for (int i = 0; i < n; i++)
for (int j = 0; j < n; j++)
res[i + j] += a[i] * b[j];
return std::move(res);
}
int k = n >> 1;
vll a1(a.begin(), a.begin() + k);
vll a2(a.begin() + k, a.end());
vll b1(b.begin(), b.begin() + k);
vll b2(b.begin() + k, b.end());
vll a1b1 = karatsubaMultiply(a1, b1);
vll a2b2 = karatsubaMultiply(a2, b2);
for (int i = 0; i < k; i++)
a2[i] += a1[i];
for (int i = 0; i < k; i++)
b2[i] += b1[i];
vll r = karatsubaMultiply(a2, b2);
for (int i = 0; i < (int)a1b1.size(); i++)
r[i] -= a1b1[i];
for (int i = 0; i < (int)a2b2.size(); i++)
r[i] -= a2b2[i];
for (int i = 0; i < (int)r.size(); i++)
res[i + k] += r[i];
for (int i = 0; i < (int)a1b1.size(); i++)
res[i] += a1b1[i];
for (int i = 0; i < (int)a2b2.size(); i++)
res[i + n] += a2b2[i];
return std::move(res);
}
示例4: gen
void gen(void)
{
LL i,j,k;
for(i=1;i<=1005;i++) arr[i]=i*i*i;
for(i=1; i<=1005; i++)
{
for(j=i+1; j<=1005; j++)
{
k=arr[i]+arr[j];
mp[k]++;
if(mp[k]==2) cont.pb(k);
}
}
sort(cont.begin(),cont.end());
return;
}
示例5: deal
int deal(){
weight.clear();
cin >> buf;
int depth = 0;
ll tmp;
for (string::iterator ii = buf.begin(); ii != buf.end(); ii++){
switch (*ii){
case '[':
{
depth++;
}break;
case ']':
{
depth--;
}break;
case ',':break;
default:
{
tmp = 0;
while ('0' <= *ii && *ii <= '9') tmp = tmp * 10 + *ii - '0', ii++;
ii--;
weight.push_back(tmp << depth);
}
}
}
sort(weight.begin(), weight.end());
int len = weight.size();
int best = 0, cur = 1;
weight.push_back(-1);
for (int i = 0; i < len; i++){
if (weight[i + 1] != weight[i]){
best = max(best, cur);
cur = 1;
}
else cur++;
}
return len - best;
}
示例6: in_lookup
bool in_lookup(const vll &l, long long n) // Lookup table method
{
return std::find(l.begin(), l.end(), n) != l.end();
}