codeforce 66C. Petya and File System(MAP)
来源:互联网 发布:java如何实现对象克隆 编辑:程序博客网 时间:2024/05/22 11:58
思路:挨个切包,用MAP记录。
#include<iostream>#include<string>#include<map>#include<algorithm>using namespace std;string s;map<string,int>fi,bag;map<string,int>::iterator it;int main(){fi.clear();bag.clear(); while(cin>>s) { int v=0; while(1) { int pos=s.find_last_of('\\'); if(pos==2)break; s.erase(s.begin()+pos,s.end()); bool flag=fi[s]==0&&bag[s]==0; bag[s]+=v; if(flag)++v; ++fi[s]; } } int x=0,y=0; for(it=bag.begin();it!=bag.end();++it) x=max(x,it->second); for(it=fi.begin();it!=fi.end();++it) y=max(y,it->second); cout<<x<<" "<<y<<"\n";}
- codeforce 66C. Petya and File System(MAP)
- Codeforces 66C Petya and File System(STL--map)
- [Codeforces 66C] Petya and File System (模拟)
- CodeForce 66A Petya and Java
- CodeForce #319 div 2 C Vasya and Petya's Game
- codeforce 66E - Petya and Post(dp+减少冗余)
- CF#61(div2)_C Petya and File System
- codeforce--Vasya and Petya's Game
- 【CodeForce】 4C Registration system(map乱搞)
- 51nod-【codeforce】A. Vasya and Petya's Game
- codeforce 12C map
- codeforce 416C Booking System
- 【CODEFORCE 4C】map容器的妙用——Registration system
- codeforces 111C Petya and Spiders
- 【codeforces 111C】 Petya and Spiders
- CodeForces - 111C Petya and Spiders
- CodeForces 890C Petya and Catacombs
- The System.map File
- 判断是否存在给定树的子结构
- fedora 18 问题汇总,包括konsole光标的漂移
- Safecracker
- PowerDesigner中CDM和PDM数据类型的mapping
- 从C#中移植CRC64(ECMA-182)的实现到 MySQL 存储过程
- codeforce 66C. Petya and File System(MAP)
- Struts2 XML配置详解
- 编程之美:子数组的最大乘积
- window.local.href编码
- 各嵌入式web服务器对比
- Qt重绘之update,repaint详解
- ipv6_route的内容解释
- twitter分享问题(二)—— Unknown error(403)
- VS2010 编译驱动设置