hdu 4451 Dressing

本文介绍了解答HDU在线评测平台上的简单题目(编号为4451)的方法,涉及到C++编程语言的基本操作,如数组、字符串处理、条件判断等。通过阅读代码,可以了解到如何使用C++解决这类基础问题。

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;
}

 

转载于:https://www.cnblogs.com/liulangye/archive/2012/11/05/2755528.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值