文章
19
粉丝
21
获赞
5
访问
19.1k
# include <bits/stdc++.h>
using namespace std;
const int N = 110;
int h[N],e[N],ne[N],idx = 0;
int n,m,max_floor = 0;
int cnt[N];
void add(int a,int b){
e[idx] = b,ne[idx] = h[a],h[a] = idx ++;
}
void dfs(int u,int f){
max_floor = max(max_floor,f);
if (h[u] == -1){
cnt[f] ++;
return;
}
for (int i = h[u]; i != -1; i = ne[i]){
int j = e[i];
dfs(j,f + 1);
}
}
int main (void){
memset(h, -1 ,sizeof h);
memset(cnt, 0 ,sizeof cnt);
scanf("%d%d",&n,&m);
while (m --){
i...
登录后发布评论
暂无评论,来抢沙发