Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
Compile Error:LINK : fatal error LNK1104: cannot open file 'lnk6965.tmp'系统有问题?LINK : fatal error LNK1104: cannot open file 'lnk6965.tmp' #include<iostream> #include<queue> using namespace std; int color[100002]={0}; int d[100002]={0}; std::queue<int>q; int n,k; void BFS(){ int t; while(!q.empty()){ t=q.front(); if(t==k){ printf("%d\n",d[t]); return; } color[t]=1; q.pop(); if(t>0&&!color[t-1]){ color[t-1]=1; d[t-1]=d[t]+1; q.push(t-1); } if(t<100000&&!color[t+1]){ color[t+1]=1; d[t+1]=d[t]+1; q.push(t+1); } if(t<50001&&!color[t<<1]){ color[t<<1]=1; d[t<<1]=d[t]+1; q.push(t<<1); } } } int main(){ scanf("%d%d",&n,&k); q.push(n); BFS(); return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator