本文主要是介绍【模拟赛】2021.8.14.C,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
目录
- 题目描述
- 思路
- 代码
题目描述
给出一颗树,将这棵树分成若干个部分,每部分的节点数相同
求方案数
思路
将树分成a部分,每部分节点数为b
易得a*b=n,且这种分发是固定的
所以我们可以枚举n的约数i
然后判断是否可以分
详情见代码
代码
#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>
#include<cmath>
using namespace std;struct wh_
{int w, h;
}wh[5000250];int h[1000250], size[1000250];
int n, x, y, t, Ans, sum;inline int read()
{int x
这篇关于【模拟赛】2021.8.14.C的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!