- 博客(7)
- 资源 (8)
- 收藏
- 关注
原创 1087. All Roads Lead to Rome (30)
#include #include #include #include #include using namespace std; const int N=300; int pos; string name[300]; int s2i(string s) { static unordered_mapnth; auto it=nth.find(s); if(it!=nth.end())
2015-03-18 13:38:14 410
原创 1086. Tree Traversals Again
这个题让我想起“递归改写成循环”这个问题,所有递归都可以用步骤标记的方式改写成循环,尤其是树的非递归式遍历挺有意思 #include #include using namespace std; struct node{int lch,rch;}; node v[60]; int pop[60],id[60]; void post(int k){ if(!k)return ; static
2015-03-18 11:30:21 286
原创 1085. Perfect Sequence (25)
又一个线性扫描数组的例子 #include #include #include using namespace std; int main(){ long long n,p;cin>>n>>p; vectorv(n); for(auto&x:v)cin>>x; sort(v.begin(),v.end()); long long pos=0,maxlen=0; for(l
2015-03-18 10:57:24 359
原创 1078. Hashing
#include #include using namespace std; vectorused(10003); bool isprime(int k){ if(k==1)return false; if(k==2||k==3)return true; for(int i=2;i*i<=k;++i) if(k%i==0)return false; return true;
2015-03-17 23:57:10 285
原创 lower_bound与upper_bound
int lowerbound(int l,int r,int target){ while(l<=r){ int mid=(l+r)>>1; if(val[mid]>=target)r=mid-1; else l=mid+1; } return l; }int upperbound(int l,int r,int target){ while(l<=r){
2015-03-16 09:14:53 293
原创 8-05. 银行排队问题之“多队列多窗口”版
可能有些条件没说明白吧,有一个case没过,不过思路差不多就是这样,到来时把该离队的人都强制离队,此时有不满员的队伍就排队,否则队伍全满,找队头最先离开的那个队伍,强制其离队 #include #include #include using namespace std; const int N=10004,K=1003; int come[N],cost[N],serve[N],n,k,m,le
2015-03-09 11:50:03 2258
原创 8-04. 打印学生选课清单
#include #include #include #include using namespace std; char name[5]; int f(char*p){return (p[0]-'A')*6760+(p[1]-'A')*260+(p[2]-'A')*10+p[3]-'0';} unordered_multimapke; int main(){ int n,k;scanf("
2015-03-06 13:45:10 1997
Learn Windows PowerShell 3 in a Month of Lunches, 2nd Edition.pdf
2017-01-05
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人