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

Re:赤裸裸的普里姆怎会超时??

Posted by yangyalan at 2012-09-01 22:06:33 on Problem 1258
In Reply To:Re:赤裸裸的普里姆怎会超时?? Posted by:yangxw at 2010-11-17 23:29:22
> // yan.cpp : 定义控制台应用程序的入口点。
> //
> #include<iostream>
> using namespace std;
> int prim()
> {
> 	start:int n;
> 	cin>>n;
> 	if(n<3&&n>100)return 0;
> 	int a[101][101];
> 	int i,j,temp=0,min=0;
> 	for(i=1;i<n+1;i++)
> 		{
> 			for(j=1;j<n+1;j++)
> 		    {
> 			cin>>a[i][j];
> 			}
> 	    }
> 	for(i=1;i<n;i++)
> 	    {
> 			temp=a[i][i+1];
> 		    for(j=i+1;j<n;j++)
> 		    {
> 			while(temp>a[i][j+1])temp=a[i][j+1];
> 		    }
> 			min=min+temp;
> 	    }
> 	cout<<min;
> goto start;
> return 0;
> }
> int main()
> {
> 	prim();
> 	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