本文整理汇总了C++中vint类的典型用法代码示例。如果您正苦于以下问题:C++ vint类的具体用法?C++ vint怎么用?C++ vint使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了vint类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ecrire
// écrit la liste d'entiers I
void ecrire(vint I)
{
printf("vint : %d valeur(s)\n", I.size());
for (unsigned int i=0; i < I.size(); i++)
printf(" %d", I[i]);
printf("\n");
}
示例2: copy
static void copy(vint v, vint& u){
if(!u.init()) return;
while(v.capacity > u.capacity) u.aumenta();
u.sz = v.size();
for(int i = 0; i < v.size(); i++){
*u[i] = *v[i];
}
}
示例3: f
void TestWidget::loadInjection(const QString & file )
{
QString f(":/test/wtr/");
f+=file;
QFile filein(f);
if (!filein.open(QFile::ReadOnly))
qDebug("Nie udane otwarcie pliku: %s",qPrintable(file));
/* for (int i=0;i<11;i++)
{
filein.getline(buffer,1023,'\n'); // pominiecie nag³ówka
//cout<<buffer<<endl;
}
*/
double /*pos, vel,*/p1,p2,p3;
times.clear(); // vint
// velocity.clear(); // vint
press1.clear(); // vint;
press2.clear();
press3.clear();
// position.clear(); //lpair
int time = 0;
QTextStream stream(&filein);
while (!filein.atEnd())
{
///stream>>pos;
stream>>p3;
stream>>p1;
stream>>p2;
//qDebug("Strem %f,%f,%f",p1,p2,p3);
stream.readLine() ; // getline(buffer,1023,'\n'); // eat rest of the line
// filein>>vel;
times.push_back(time);
// position.push_back( pair<double,double>(time,pos));
// velocity.push_back((int)vel);
press1.push_back((int)p1);
press2.push_back((int)p2);
press3.push_back(p3);
//filein>>buffer;
// cout<<time<<" p:"<<pos<<" v:"<<vel<<" p1:"<<p1<<endl; //" "<<p2<<" "<<p3<<endl;
++time;
}
chart->channels().clear();
initCharts();
chart->update();
}
示例4: setValues
void ParameterSlider::setValues(const vint& values, const QStringList& labels)
{
Q_ASSERT(values.size() == labels.size());
m_values = values;
m_labels = labels;
setEnabled(m_values.size() > 1);
if (!m_values.empty()) {
m_ui->slider->setRange(0, m_values.size() - 1);
setSliderPosition(0);
}
}
示例5: sortit
void sortit(vint arr){
int n= arr.size();
for(int i= 0; in-1; i++){
for(int j= i; jn-1; j++){
if(arr[j] arr[j+1]){
swap(arr[j], arr[j+1]);
}
}
}
for(int i= 0; in; i++){
cout arr[i] ;
}
}
示例6: main
int main(){
CPPinput;
int n; cin>>n;
if(n==1)exit((cout<<"YES\n1\n",0));
if(n==2)exit((cout<<"NO"<<endl,0));
int root=0;
for(int i=1;i<=n;++i){
int pa; cin>>pa;
if(pa)G[pa].pb(i),G[i].pb(pa);
else root=i;
}
for(int i=1;i<=n;++i)deg[i]=G[i].size();
dfs(root,root);
/* auto cmp=[&](const int &a,const int &b){return dep[a]<dep[b];};
priority_queue<int,vint,decltype(cmp)> pq(cmp);
for(int i=1;i<=n;++i){
if(son[i].size()==0)pq.push(i);
}
PDE(pq);
inq[0]=1;
while(pq.size()){
int now=pq.top(); pq.pop();
PDE(pq,now,del[now],deg[now]);
if(del[now])continue;
if(deg[now]&1){
int pa=p[now];
if(inq[pa])continue;
pq.push(pa);
inq[pa]=1;
continue;
}
// ans.pb(now);
// del[now]=1;
int pa=p[now];
--deg[pa];
son[pa].erase(now);
if(son[pa].empty()){
if(inq[pa]);
else{
pq.push(pa);
inq[pa]=1;
}
}
go(now);
} */
PDE(ans);
if(ans.size()!=n)exit((cout<<"NO"<<endl,0));
cout<<"YES"<<endl;
for(int i:ans)cout<<i<<'\n';
}
示例7: show
void show(const vint & v, int cols)
{
using std::cout;
using std::endl;
int lim = v.size();
for(int i = 0; i < lim; ++i)
{
cout.width(3);
cout << v[i];
if(i % cols == cols - 1)
cout << endl;
else
cout << ' ';
}
if(lim % cols != 0)
cout << endl;
}
示例8: hash
long long hash(vint x) {
long long s = 0;
for (int i = 0; i < x.size(); i++)
s = (s * 2333333 + (x[i]+1)) % 23333333333333333LL;
return s;
}
示例9: even
void even(int n){
int ptr=upper_bound(p.begin(),p.end(),n>>1)-p.begin()-1;
while(ptr>=0){
if(sp.find(n-p[ptr])!=sp.end()){
printf("2 %d %d\n",p[ptr],n-p[ptr]);
return;
} --ptr;
}
}
示例10: pnt
void pnt(int lft,int st){
pit(mx);el;
while(lft>=st){
ans.pb(st);
lft-=st;
++st;
}
ans.back()+=lft;
for(auto &i:ans)pit(i),spc;el;
}
示例11: main
int main(){
int ts; cin>>ts; while(ts--){
pos.clear();
int n,k; cin>>n>>k; for(int i=0,t;i<n;++i){
cin>>t; pos.pb(t);
} sort(pos.begin(),pos.end());
int L=0,R=1000000000,M; while(R>L){
M=(L+R)>>1; if(can(M,k))R=M;
else L=M+1;
} cout<<L<<endl;
}
}
示例12: dfs
bool dfs(int n,int lft){
if(lft==1){
if(sp.find(n)!=sp.end()){
oa[0]=n;return 1;
} return 0;
}
else if(lft==2){
int ptr=upper_bound(p.begin(),p.end(),n>>1)-p.begin()-1;
while(ptr>=0){
oa[1]=p[ptr];
if(dfs(n-p[ptr],lft-1))return 1;
} --ptr;
return 0;
}
示例13: go
void go(int now,int pa){
if(del[now])return;
ans.pb(now);
del[now]=1;
for(int i:G[now]){
if(i!=pa)go(i,now);
}
}
示例14: init
void init(){
for(int i=2;i<=1000;++i){
if(!v[i])p.pb(i);
for(int j=0;i*p[j]<=1000;++j){
v[i*p[j]]=1;
if(i%p[j]==0)break;
}
}
for(int i:p)sp.insert(i);
}
示例15: outit
void outit() {
int i , j , k;
ff(i,tolans) pb(xu,i);
sort2(xu);
ff(i,xu.size()) cout << xu[i] << ' ' << d[xu[i]].size() << endl;
cout << endl;
ff(i,tolans) {
sort1(ans[xu[i]]);
ff(j,ans[xu[i]].size()) cout << ans[xu[i]][j] << ' ';
cout << endl;
}