Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Compile Error:LINK : fatal error LNK1104: cannot open file 'lnk6965.tmp'系统有问题?

Posted by typ04 at 2011-08-25 19:06:15 on Problem 3278
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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator