#include<iostream> #include<vector> #include<algorithm> using namespace std; vector<int>vd; vector<int>vn; int n; int minsize; int maxsize; int main() { int d=0; int msize=0; int mxsize=0; cin>>minsize>>maxsize; d=maxsize-minsize+1; msize=minsize; vd.resize(d); for(int i=0;i<d;++i) vd[i]=msize++; cin>>n; vn.resize(n); for(int i=0;i<n;++i) cin>>vn[i]; for(auto i:vn) { msize=2*i; mxsize=10*i; auto j=lower_bound(vd.begin(),vd.end(),msize); auto k=upper_bound(vd.begin(),vd.end(),mxsize); vd.erase(j,k); } cout<<vd.size()<<endl; return 0; }
标签:vd,求解,int,vn,好多,minsize,maxsize,msize,P1794 From: https://www.cnblogs.com/lhf123/p/17430769.html