天南之城的后花园

记录精彩的程序人生

文章

PAT 1004 数叶子

1004 Counting Leaves A family hierarchy is usually presented by a pedigree tree. Your job is to count those family members who have no child. 一个家庭的层级结构通常用家谱树来表示。你的任务是统计那些没有孩子的家庭成员。 输入格式: Each input file contains one test case. Each case starts with a line containing 0<N<100, the number of nodes in a tree, and M (<N), the number of non-leaf nodes. Then M lines follow, each in the format: ID K ID[1] ID[2] ... ID[K] where ID is a two-digit number representing a given non-leaf node, K is t....

记录精彩的程序人生

© 2025 天南之城的后花园

Powered by Bolo
Theme bolo-sakura by Mashiro
浏览 50964 文章 43 评论 11
蜀ICP备2023008301号

主题 | Theme