First from the clothes to the trousers, from the trousers to the shoes
#include <iostream>#include<cstdio>#include<cstdlib>#include<cstring>#include<algorithm>#include<queue>#include<vector>#include<cmath>#include<map>#include<string>using namespacestd;Const intmaxn= ++Ten;Long LongA[MAXN][MAXN];Long LongB[MAXN][MAXN];Long LongANS1[MAXN],ANS2[MAXN];Chars1[ +],s2[ +];intx, y;intn,m,k,p;intMain () { while(~SCANF ("%d%d%d",&n,&m,&k)) {if(!n&&!m&&!k) Break; scanf ("%d",&Q); memset (ans1,0,sizeofans1); memset (Ans2,0,sizeofans2); for(intI=1; i<=n;i++) for(intj=1; j<=m;j++) a[i][j]=0; for(intI=1; i<=m;i++) for(intj=1; j<=k;j++) b[i][j]=0; for(intI=1; i<=p; i++) {scanf ("%s", S1); scanf"%d",&x); scanf ("%s", S2); scanf"%d",&y); if(strcmp ("clothes", s1) = =0) a[x][y]=1; Else if(strcmp ("Pants", s1) = =0) b[x][y]=1; } for(intj=1; j<=m; J + +) { Long Longsum=0; for(intI=1; i<=n; i++) { if(a[i][j]==0) Sum=sum+1; } Ans1[j]=sum; } for(intj=1; j<=k; J + +) { Long Longsum=0; for(intI=1; i<=m; i++) { if(b[i][j]==0) {sum=sum+Ans1[i]; }} Ans2[j]=sum; } Long Longans=0; for(intI=1; i<=k; i++) ans=ans+Ans2[i]; printf ("%lld\n", ans); } return 0;}
HDU 4451 dressing