【火腿赛区现场赛Problem J】妈妈说阿迪王比耐克牛-Dressing
来源:互联网 发布:手机上怎么注册淘宝号 编辑:程序博客网 时间:2024/06/08 07:00
FROM:2012-10-28 ACM/ICPC ASIA JinHua Area,Problem J. 点击打开链接
这个题看着虎,其实还是很水。。。。但因为阅读理解,坑了一些时间。难得这么大的比赛有两道不用脑子的水题。。。
描述上亮点颇多:
1、Mom thinks that pants-shoes pair is disharmonious becauseAdiwang is much better than Nike.(囧RZ)
2、Next P lines each line will be one of the two forms“clothes x pants y” or “pants y shoes z”.(这说明只有两种情况 没有clothes和shoes一起不和谐的情况)
3、For each case, the first line contains 3 integers N,M,K(1≤N,M,K≤1000) indicating the number of clothes, pants and shoes.Second line contains only one integer P(0≤P≤2000000) indicating the number of pairs which mom thinks disharmonious.(注意200000,这说明不用按部就班的模拟,否则TLE)
明白了这些,AC便指日可待了……
1TLE(200000纯属坑爹的) 1WA(数组初始化开错了) 1AC:
#include <iostream>#include <string>#include <cstring>using namespace std;const int INF=1005;int clothes[INF],pants[INF],shoes[INF];int main(){int yi,ku,xie;while(cin>>yi>>ku>>xie && (yi!=0 || ku!=0 || xie!=0)){for(int i=0;i<=INF;i++){clothes[i]=0;pants[i]=0;shoes[i]=0;}int hexienum,result=0;cin>>hexienum;if(hexienum==0){cout<<yi*ku*xie<<endl;continue;}else{for(int i=0;i<hexienum;i++){string opa,opb;int buhexie1,buhexie2;cin>>opa>>buhexie1>>opb>>buhexie2;if(opa=="clothes" || opb=="clothes"){clothes[buhexie2]++;}if(opb=="shoes" || opa== "shoes"){shoes[buhexie1]++;}}for(int i=1;i<=ku;i++){result+=(xie-shoes[i])*(yi-clothes[i]);}cout<<result<<endl;}}return 0;}
- 【火腿赛区现场赛Problem J】妈妈说阿迪王比耐克牛-Dressing
- 【火腿赛区现场赛Problem I】难得有道决赛题这么水-Draw Something
- hdu 5920 Ugly Problem 2016ACM/CCPC长春赛区现场赛J
- 2014ACM广州赛区现场赛J题题解.
- HDU-4451-Dressing (2012年金华赛区J题)
- hdu 4473 Exam (2012ACM成都赛区现场赛J题)
- HDU 4790 2013 ACM/ICPC 成都赛区现场赛 J. Just Random
- HDU 4790 Just Random (2013ACM/ICPC成都赛区现场赛J题)
- HDU 4462 Scaring the Birds (2012年杭州赛区现场赛J题)
- hdu 5919 Sequence II 2016ACM/CCPC长春赛区现场赛J
- HDU 5536 2015ACM-ICPC长春赛区现场赛J题
- 2012 金华赛区现场赛
- 【杭州赛区现场赛PROBLEM I】阅读理解与模拟-The Power of Xiangqi
- 2012ACM/ICPC成都赛区现场赛K题---Yet Another Multiple Problem(hdu4474)
- hust1720-Rent House-2017华科现场赛J题-莫比乌斯反演
- 2015ACM-ICPC 北京赛区 Problem J. Osu! Master
- 2010 ACM/ICPC 福州赛区 Problem J(穷举)
- 2014北京赛区现场赛解题报告
- 谁会成为OpenStack领域的Linus Torvalds?
- android dialog自动关闭
- JAVA 中的 Native Method
- Android一年恶意软件翻近六倍 问题严峻
- Android 布局属性详解
- 【火腿赛区现场赛Problem J】妈妈说阿迪王比耐克牛-Dressing
- 2012年五个最致命的移动恶意软件排行
- Datepicker使时间拖动条设为每5分钟一档
- 迈克菲详解Android.FakeInstaller恶意伪装程序
- Linux入门
- c语言核心技术 一
- 判斷進程是否具有管理員權限(代碼來自微軟SDK)
- 程序员软件开发的酸甜苦辣:漫画图赏
- Android闹钟的实现!