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

部分代码

Posted by 1339097071 at 2015-08-20 10:46:01 on Problem 1502
#include<cstdio>
#include<cstring>

using namespace std;
struct node
{
	int x,y,next,t;	
}a[21000];
int last[21000],len;
void ins(int x,int y,int t)
{
	len++;
	a[len].x=x;a[len].y=y;a[len].t=t;
	a[len].next=last[x];last[x]=len;
}
int d[1100],tt[110];
int head,tail,list[1100];
bool v[1100];
int main()
{
	int i,j,n,A,B,m,x,y,max=0;
	tt[1]=1;
	for (i=2;i<=10;i++) tt[i]=tt[i-1]*10;
	scanf("%d",&n);
	memset(last,0,sizeof(last));len=0;
	memset(v,false,sizeof(v));
	for (i=2;i<=n;i++)
	{
		for (j=1;j<i;j++)
		{
			char ss[110];
			scanf("%s",ss+1);
			if (ss[1]=='x') 
			{
				ins(j,i,99999999);
				ins(i,j,99999999);
			}
			else
			{
				int ans=0;
				for (int ii=strlen(ss+1);ii>=1;ii--)
				{
					ans+=(ss[ii]-'0')*tt[ strlen(ss+1)-ii+1 ];
				}
				ins(j,i,ans);
				ins(i,j,ans);
			}
		}
	}
	for (i=1;i<=1000;i++) d[i]=99999999;
	head=1;tail=2;
	list[1]=1;v[1]=true;d[1]=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