本文整理汇总了C++中IV::push_back方法的典型用法代码示例。如果您正苦于以下问题:C++ IV::push_back方法的具体用法?C++ IV::push_back怎么用?C++ IV::push_back使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IV
的用法示例。
在下文中一共展示了IV::push_back方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: prime_sieve
void prime_sieve() {
for ( int i = 3; i <= SQRP; i += 2 )
if ( !IsComp(i) ) for ( int j = i*i; j <= MAXP; j+=i+i ) SetComp(j);
primes.reserve ( 65536 );
primes.push_back ( 2 );
for ( int i = 3; i <= MAXP; i += 2 ) if ( !IsComp(i) ) primes.push_back ( i );
}
示例2: add
void add(Key k, int v) {
int i = fnv_hash(k, KeySz) % HASHB;
for (int j = 0, J = b[i].size(); j < J; ++j)
if (b[i][j].k == k) { b[i][j].v.push_back(v); return; }
IV val;
val.push_back(v);
b[i].push_back(KV(k, val));
}
示例3: solve
bool solve()
{
int sz1 = n/2;
group1 = IV();
group1.push_back(0);
for (int i = 0; i < sz1; ++i) {
IV aux;
cFor (IV, v, group1) {
aux.push_back(*v);
aux.push_back(*v + A[i]);
aux.push_back(*v + A[i] + A[i]);
}
group1 = aux;
}
示例4: topo_sort
void topo_sort(IV &in, IV &order) {
IQ q;
for (int i = 0; i < n; ++i) if (in[i] == 0) q.push(i);
order.clear();
while (! q.empty()) {
int v = q.front(); q.pop();
order.push_back(v);
cFor (EL, e, adj[v])
if (--in[e->v] == 0) q.push(e->v);
}
}
示例5: test_case
void test_case()
{
int n = rand() % (MAXN - 2) + 3;
int MaxEdges = min(n*(n-1)/2, MAXM);
int m = rand() % (MaxEdges + 1);
if (m < n - 1) m = n - 1;
printf("\n%d %d\n", n, m);
IV ls;
IIS s;
for (int i = 0; i < n; ++i)
ls.push_back(i);
random_shuffle(ls.begin(), ls.end());
printf("%d %d\n", ls[0], ls[1]); --m;
int u = ls[0], v = ls[1];
if (u > v) swap(u, v);
s.insert(II(u, v));
for (int i = 2; i < n; ++i) {
u = ls[rand() % i], v = ls[i];
printf("%d %d\n", u, v); --m;
if (u > v) swap(u, v);
s.insert(II(u, v));
}
while (m--) {
int u, v;
do {
u = rand() % n;
v = rand() % n;
if (u > v) swap(u, v);
} while (u == v || s.find(II(u, v)) != s.end());
s.insert(II(u, v));
if (rand() % 2 == 0) swap(u, v);
printf("%d %d\n", u, v);
}
}
示例6: Set
Set(int n) { for (int i=0; i <= n; ++i) s.push_back(i); }