HDU——Draw Something
2012-10-29 15:34
225 查看
http://acm.hdu.edu.cn/showproblem.php?pid=4450
金华的比赛太残酷了,4题是打铁还是银牌取决于手速和准确率啊!
这个题目也是上面的一道水题,因为
clothes —— pants——shoes中,所禁止的搭配都有pants,所以可以枚举pants,
对于每一个pants,找到可以搭配的clothes和shoes相乘,就可以了。
如果改变题目,也对clothes 和 shoes之间有要求,那么应该如何处理呢?
看到的大神指教一下!
金华的比赛太残酷了,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 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 (2012年金华赛区I题)
- HDU 4450 Draw Something
- hdu 4450 Draw Something
- HDU 4450 Draw Something 2012亚洲区域赛金华现场赛I题
- HDU 3347:Calculate the expression
- 雷锋实验室 Draw Something的中国门徒
- hdu 4363 Draw and paint
- hdu 1010
- HDU 3555 \数位DP
- hdu 3790
- HDU 4665