模拟题,map搞一搞。要想清楚一个结点应该是要通过一个字符串找到下一个结点,题目保证所以文件夹非空,所以只要判断一个结点是不是叶子结点就可以判断它是不是文件,用了点c11的特性。

#include<bits/stdc++.h>
using namespace std; typedef map<string,int> Node;
map<string,int>::iterator it_id;
const int maxnd = 1e4;
Node nds[maxnd];
int nds_cnt;
#define MP make_pair
#define fi first
#define se second inline int id(const string& s,Node& fa)
{
if((it_id = fa.find(s)) != fa.end()) return it_id->second;
fa.insert(MP(s,++nds_cnt));
return nds_cnt;
} int curFile,curFolder;
void dfs(int u)
{
for(auto it: nds[u]){
if(nds[it.se].empty()) { curFile++; continue; }
else curFolder++;
dfs(it.se);
}
} #define cer(x) cout<<x<<endl;
#define PB push_back int main()
{
//freopen("in.txt","r",stdin);
ios_base::sync_with_stdio(false);
string s;
while(cin>>s){
auto u = nds;
u = nds+id(s.substr(,),*u);
s.PB('\\');
for(int i = , j = ; i < (int)s.size(); i++){
if(s[i] == '\\'){
u = nds+id(s.substr(j,i-j),*u);
j = i+;
}
}
}
int maxFolder = ,maxFile = ; for(auto it: nds[]){
for(auto it2: nds[it.se]){
curFolder = curFile = ;
dfs(it2.se);
maxFolder = max(maxFolder,curFolder);
maxFile = max(maxFile,curFile);
}
}
cout<<maxFolder<<' '<<maxFile<<endl;
return ;
}

CodeForces 66C Petya and File System (实现)的更多相关文章

  1. Design and Implementation of the Sun Network File System

    Introduction The network file system(NFS) is a client/service application that provides shared file ...

  2. 乌版图 read-only file system

    今天在启动虚拟机的时候,运行命令svn up的时候,提示lock,并且read-only file system,这个....我是小白啊,怎么办?前辈在专心写代码,不好打扰,果断找度娘啊 于是乎,折腾 ...

  3. File system needs to be upgraded. You have version null and I want version 7

    安装hbase时候报错: File system needs to be upgraded. You have version null and I want version 7 注: 我安装的hba ...

  4. Linux系统启动错误 contains a file system with errors, check forced解决方法

    /dev/sda1 contains a file system with errors, check forced./dev/sda1: Inodes that were part of a cor ...

  5. Linux 执行partprobe命令时遇到Unable to open /dev/sr0 read-write (Read-only file system)

    在使用fdisk创建分区时,我们会使用partprobe命令可以使kernel重新读取分区信息,从而避免重启系统,但是有时候会遇到下面错误信息"Warning: Unable to open ...

  6. 磁盘、分区及Linux文件系统 [Disk, Partition, Linux File System]

    1.磁盘基础知识 1.1 物理结构 硬盘的物理结构一般由磁头与碟片.电动机.主控芯片与排线等部件组成:当主电动机带动碟片旋转时,副电动机带动一组(磁头)到相对应的碟片上并确定读取正面还是反面的碟面,磁 ...

  7. Linux File System

    目录 . Linux文件系统简介 . 通用文件模型 . VFS相关数据结构 . 处理VFS对象 . 标准函数 1. Linux文件系统简介 Linux系统由数以万计的文件组成,其数据存储在硬盘或者其他 ...

  8. ORA-00245: control file backup failed; target is likely on a local file system

    ORACLE11G RAC alert报错如下:Errors in file /u01/app/oracle/diag/rdbms/dljyzs/dljyzs1/trace/dljyzs1_ora_8 ...

  9. 读Avoiding the Disk Bottleneck in the Data Domain Deduplication File System

    最近在思考和实践怎样应用重复数据删除技术到云存储服务中.找了些论文来读,其中<Avoiding the Disk Bottleneck in the Data Domain Deduplicat ...

随机推荐

  1. SO_REUSEADDR的分析

    今天协议个socket程序时碰到了这个问题,选自博客http://www.cppblog.com/ace/archive/2006/04/29/6446.html 敲完代码,等下看它.

  2. Unity中场景异步加载

    引入命名空间 using UnityEngine.UI; using UnityEngine.SceneManagement; using System.Collections; using Syst ...

  3. Xilinx SDSoc 加载opencv库

    Xilinx SDSoc 加载opencv库需要下载两个文件 xfopencv 和 Revision Platform, Revision Platform需要和具体的开发板型号对应,我用的是zcu1 ...

  4. 你需要了解的有关.NET日期时间的必要信息

    引言    DateTime数据类型是一个复杂的问题,复杂到足以让你在编写[将日期从Web服务器返回到浏览器]简单代码时感到困惑. ASP.NET MVC 5和 Web API 2/ASP.NETCo ...

  5. svn git 的区别(别再问我了)

    这篇主要是谈谈两者的区别,至于谁优谁劣看官自己思考吧! 把第一条理解到位思想到位了做起来才会有的放矢,其他几条都是用的时候才能体会到 1) 最核心的区别Git是分布式的,而Svn不是分布的.能理解这点 ...

  6. 自定义Swap

    网上看到的一篇文章加深了对指针的了解,收藏一下 自定义的swap函数是一个老掉牙的问题,而这个问题对于理解指针和内存中的栈是很有帮助的 一般自定swap函数是这样的: 1.swap函数的功能是实现两个 ...

  7. php SHA256Hex加密

    function SHA256Hex($str){ $re=hash('sha256', $str, true); return bin2hex($re); }

  8. 脑图和MarkDown

    使用脑图整理前端体系 根据以下网址整理 http://web.jobbole.com/84062/ http://naotu.baidu.com/ 学习MarkDown语法格式 (一) 标题 在首行插 ...

  9. scikit-learn使用fetch_mldata无法下载MNIST数据集的问题

    scikit-learn使用fetch_mldata无法下载MNIST数据集的问题 0. 写在前面 参考书 <Python数据科学手册> 工具 python3.5.1,Jupyter La ...

  10. 详解环境搭建SSM

    1.概述: SSM即为spring 4 +spring mvc +mybatis 3.4.6 推荐使用maven或者gradle 来配置 下面给出maven配置方式 2.项目结构: 新建web项目 这 ...