http://acm.hdu.edu.cn/showproblem.php?pid=4451

水题

代码:

#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<vector>
#include<set>
#include<queue>
#include<stack>
#include<map>
#include<string>
#include<iomanip>
using namespace std;

#define LL long long
const int INF=0x5fffffff;
const double FINF=1e9;
const LL MOD=365*24*60*60;
const int N=1005;
bool ab[N][N];
int numb[N];
int main()
{
    //freopen("data.txt","r",stdin);
    int n,m,k;
    while(cin>>n>>m>>k)
    {
        if(!n&&!m&&!k)
        break;
        memset(ab,true,sizeof(ab));
        for(int i=1;i<=k;++i)
        numb[i]=k;
        int p;
        cin>>p;
        while(p--)
        {
            string s1,s2;
            int l1,l2;
            cin>>s1>>l1>>s2>>l2;
            if(s1=="clothes")
            {
                ab[l1][l2]=false;
            }else
            {
                --numb[l1];
            }
        }
        int ans=0;
        for(int i=1;i<=n;++i)
        for(int j=1;j<=m;++j)
        {
            if(ab[i][j])
            {
                ans+=numb[j];
            }
        }
        cout<<ans<<endl;
    }
    return 0;
}

 

posted on 2012-11-05 17:20  夜->  阅读(118)  评论(0编辑  收藏  举报