main() { // freopen("ginp.txt","r",stdin); // freopen("gout.txt","w",stdout); int numcase,k; scanf("%d",&numcase); for (int t=1;t<=numcase;t++) { Inp(); k=Run(); printf("Case %d: ",t); switch (k) { case 1: printf("Square\n"); break; case 2: printf("Rectangle\n"); break; case 3: printf("Rhombus\n"); break; case 4: printf("Parallelogram\n"); break; case 5: printf("Trapezium\n"); break; case 6: printf("Ordinary Quadrilateral\n"); break; } // printf("abcd %d %d %d %d\n",a,b,c,d); // printf("canh %d %d %d %d\n",c1,c2,c3,c4); // printf("cheo %d %d\n\n",cheo1,cheo2); } }
int main() { // Read input and populate graph[][] // Set m, n long cnt,i; while(scanf("%ld",&n)==1) { m=n; memset( matchL, -1, sizeof( matchL ) ); memset( matchR, -1, sizeof( matchR ) ); memset(graph,0,sizeof(graph)); Inp(); cnt = 0; for(i = 0; i < m; i++ ) { memset( seen, 0, sizeof( seen ) ); if( bpm( i ) ) cnt++; } printf("%ld\n",n-cnt/2); // cnt contains the number of happy pigeons // matchL[i] contains the hole of pigeon i or -1 if pigeon i is unhappy // matchR[j] contains the pigeon in hole j or -1 if hole j is empty } return 0; }