HDU——Draw Something
来源:互联网 发布:天罡掌诀推算法 编辑:程序博客网 时间:2024/05/22 03:24
http://acm.hdu.edu.cn/showproblem.php?pid=4450
金华的比赛太残酷了,4题是打铁还是银牌取决于手速和准确率啊!
这个题目也是上面的一道水题,因为
clothes —— pants——shoes中,所禁止的搭配都有pants,所以可以枚举pants,
对于每一个pants,找到可以搭配的clothes和shoes相乘,就可以了。
#include <cstdio>#include <cstring>using namespace std;struct node { int a, b;};node p[1100];int main() { int N, M, K; while(scanf("%d%d%d", &N, &M, &K), N) { int ans = 0; for(int i = 0; i < M; i++) { p[i].a = 0; p[i].b = 0; } int n, tmp; scanf("%d", &n); char s[100]; for(int i = 0; i < n; i++) { scanf("%s%d", s, &tmp); if(strcmp(s, "pants") == 0) { p[tmp-1].b++; } scanf("%s%d", s, &tmp); if(strcmp("pants", s) == 0) { p[tmp-1].a++; } } //puts(">>>"); for(int i = 0; i < M; i++) { //printf("%d %d\n", p[i].a , p[i].b); ans += (N - p[i].a) * (K - p[i].b); } printf("%d\n", ans); } return 0;}
如果改变题目,也对clothes 和 shoes之间有要求,那么应该如何处理呢?
看到的大神指教一下!
- HDU——Draw Something
- HDU—— 4450 Draw Something
- hdu 4450 Draw Something
- hdu 4450 Draw Something
- Hdu 4450 - Draw Something
- hdu 4450 Draw Something
- hdu 4450 Draw Something
- HDU 4450 Draw Something
- HDU 4450 Draw Something
- HDU 4450 Draw Something
- hdu 4450 Draw Something(水)
- Draw Something
- Draw Something
- Draw Something
- Draw something现象
- draw something产品分析
- hdu4450 Draw Something
- hdu4450-Draw Something
- window.onload和jQuery中的ready的区别
- oracle 函数 WMSYS.WM_CONCAT 的用法 与 mysql 函数GROUP_CONCAT的用法
- linux系统中开启Telnet服务教程
- KindEditor得不到textarea值的解决方法
- PHP数组排序函数合集
- HDU——Draw Something
- 如何在多台机器上共享IOS证书
- 私有继承中的派生类对象与基类对象间的转换
- Maven3实战笔记02坐标和依赖--1
- linux驱动头文件说明(转载)
- javascript中几种页面跳转方式
- 关于hibernate(jpa)报not-null property references a null or transient value的问题
- Proxy模式
- 颠倒栈