| 记录编号 |
125403 |
评测结果 |
AAAAAAAAAA |
| 题目名称 |
1086.[福州培训2010] 文件夹计数 |
最终得分 |
100 |
| 用户昵称 |
devil |
是否通过 |
通过 |
| 代码语言 |
C++ |
运行时间 |
0.162 s |
| 提交时间 |
2014-10-08 18:45:03 |
内存使用 |
0.31 MiB |
显示代码纯文本
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <deque>
#include <map>
#include <algorithm>
using namespace std;
map<pair<string,string>,int> floder;
int main()
{
freopen("folder.in","r",stdin);
freopen("folder.out","w",stdout);
int T=0;int ans=0;
int kase,i,j;
scanf("%d\n",&T);
for(int kase=0;kase<T;kase++)
{
char file[220];bool Root=false;
string FileName="";
string LastFile="";
scanf("%s\n",file);
int len=strlen(file);
for(i=0;i<len;i++)
{
if(file[i]=='/')
{
for(j=i+1;file[j]!='/'&&j<len;j++)
{
FileName+=file[j];
}
}
i=j-1;
if(floder[make_pair(FileName,LastFile)]==0) Root=true;
if(floder[make_pair(FileName,LastFile)]==0||Root)
{
ans++;
floder[make_pair(FileName,LastFile)]=1;
}
LastFile=FileName;
}
printf("%d\n",ans);
}
//system("PAUSE");
return 0;
}