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 |
一个小bug找了半天 贴一下源代码!汗#include<iostream> #include<stdlib.h> #include<string> #include<cmath> using namespace std; #define LEFT_MAX 110 #define RIGHT_MAX 110 bool useif[RIGHT_MAX]; int link[RIGHT_MAX]; //int left_num,right_num; bool array[LEFT_MAX][RIGHT_MAX]; struct point { double x; double y; }; bool can(int t,int m) { int i; for(i=0;i<m;i++) { if(!useif[i]&&array[t][i]) { useif[i]=true; if(link[i]==-1||can(link[i],m)) { link[i]=t; return true; } } } return false; } int main() { int n,m,s,v; int distance; while(cin>>n>>m>>s>>v&&n!=-1) { point a[110]; point b[110]; memset(link,-1,sizeof(link)); memset(array,0,sizeof(array)); memset(useif,0,sizeof(useif)); int d[110]; int m1=0,n1=0; distance=s*v; int i,j; for(i=0;i<n;i++) cin>>a[i].x>>a[i].y; for(i=0;i<m;i++) cin>>b[i].x>>b[i].y; int num=0; for(i=0;i<n;i++) { for(j=0;j<m;j++) { if((a[i].x-b[j].y)*(a[i].x-b[j].x)+(a[i].y-b[j].y)*(a[i].y-b[j].y)<=distance*distance) { array[i][j]=1; } else array[i][j]=0; } } for(i=0;i<n;i++) { memset(useif,0,sizeof(useif)); if(can(i,m)) num++; } cout<<n-num<<endl; } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator