From 6c1fb4fb63edd50864a2e47b0b719503ebc50bef Mon Sep 17 00:00:00 2001 From: Kirito <1362050620@qq.com> Date: Thu, 19 May 2016 09:27:19 +0800 Subject: [PATCH] Create 1125.cpp --- POJ/1125.cpp | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 POJ/1125.cpp diff --git a/POJ/1125.cpp b/POJ/1125.cpp new file mode 100644 index 0000000..e3bc208 --- /dev/null +++ b/POJ/1125.cpp @@ -0,0 +1,78 @@ +#include +#include +#include +using namespace std; + +#define MAXSTOCK 101 +int m[MAXSTOCK][MAXSTOCK]; + +int main() +{ + int n; + while(scanf("%d",&n)==1&&n!=0) + { + memset(m,0,sizeof(int)*MAXSTOCK*MAXSTOCK); + for(int i=1;i<=n;i++)/// From i to... + { + int s; + scanf("%d",&s); + for(int j=0;jm[i][j]?Max:m[i][j]; + if(m[i][j]) ++cnt; + } + if(cnt==n-1) + { + found=true; + if(FromPosMaxTime<0||FromPosMaxTime>Max) + { + FromPos=i; + FromPosMaxTime=Max; + } + } + } + if(!found) + { + printf("disjoint\n"); + } + else + { + printf("%d %d\n",FromPos,FromPosMaxTime); + } + } + return 0; +}