hdu 1050 (preinitilization or postcleansing, std::fill)
2015-06-18 11:33
281 查看
errors, clauses in place, logical ones, should be avoided.
[code]#include <cstdio> #include <cstring> #include <algorithm> int main() { //freopen("input.txt","r",stdin); const int CorNum=201; int ncase, npair, to,from, first,last, res; int shared[CorNum]={0}; if(scanf("%d",&ncase)!=1) return -1; while(ncase-- && scanf("%d",&npair)==1) { first=CorNum, last=0; while(npair--) { scanf("%d%d",&from,&to); from=(from-1)>>1; to=(to-1)>>1; if(from>to) std::swap(from,to); first=std::min(first,from); last=std::max(last,to); for(;from<=to;++from) ++shared[from]; } for(res=0,from=first;from<=last;++from) res=std::max(res,shared[from]); std::fill(&shared[first],&shared[last+1],0); printf("%d\n",res*10); } return 0; }
相关文章推荐
- logger框架
- dataguard报错,rac其中一个节点报错,ora-12592
- MQTT 开源代理mosquitto的网络层封装相当sucks
- Android-序
- selinux策略开发
- [Python]同是新手的我,分享一些经验
- 使用CocoaPods的例子
- Tomcat服务器配置参考
- SAT阅读:分类高频词汇小结
- 认识自己——我的恐惧和悲观
- openssl ios 公钥分段加解密
- 聊天机器人_远程接口javautil
- C++中RGB转换为ARGB
- 分支-08 高速公路超速处罚(15)
- iOS代码技巧之判断设备及状态
- jqGrid添加详细按钮,单击弹出窗体
- E3: PS4/PC 莎木3 众筹200万美元 9小时内达成
- VIM-不常用或不知道的技巧
- 使用cluvfy检查共享存储报错
- 理解Objective-C Runtime(三)消息转发机制