pat 甲级1004
这道题之前做过,这次做一直有两个测试点不能通过,问题就在于他所给出的父子关系信息时是否按照顺序给出,答案是不是,所以不能在循环内部进行level的赋值。
ac代码:
#include <iostream>
#include <vector>
using namespace std;
struct node {
int level;
bool yes;
int father;
node() {
yes = true;
}
};
int main() {
int n, m
原创
2020-05-12 17:51:28 ·
206 阅读 ·
0 评论