1 条题解
-
0
#include<bits/stdc++.h> using namespace std; string op; char a[1000]; int b[1000],mx,depth; void dfs(int deep,int now){ depth=max(deep,depth); b[deep]++; if(a[now*2]!='#')dfs(deep+1,now*2); if(a[now*2+1]!='#')dfs(deep+1,now*2+1); } int main(){ ios::sync_with_stdio(0); cin.tie(0);cout.tie(0); memset(a,'#',sizeof(a)); cin>>op; for(int i=0;i<op.size();i++)a[i+1]=op[i]; dfs(1,1); for(int i=1;i<=200;i++)mx=max(b[i],mx); cout<<depth<<endl<<mx; return 0; }
- 1
信息
- ID
- 195
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- 7
- 标签
- (无)
- 递交数
- 205
- 已通过
- 53
- 上传者