PAT考试乙级1004(C语言实现) 总结: 1、提交结果为部分正确,具体原因还不太清楚,解决后来更新。 2、这个题目不难,但是花费了不少时间,主要是在数据读取的地方出现了问题,最终使用字符数组表示字符串。 3、scanf(“%s %s %d”,name,stuNum,&score);//不要丢掉最后一个& 4、字符串不能直接赋值,可以使用...
PAT | 1004 成绩排名 (C语言) 1004 成绩排名 (20 分) 读入n(>0)名学生的姓名、学号、成绩,分别输出成绩最高和成绩最低学生的姓名和学号。 输入格式: 每个测试输入包含 1 个测试用例,格式为 第1 行:正整数 n 第2 行:第 1 个学生的姓名 学号 成绩 第3 行:第 2 个学生的姓名 学号 成绩 ……… 第...
{ 27 int n, m, id, k, c; 28 cin >> n >> m; 29 for (int i = 0; i < m; i++) { 30 cin >> id >> k; 31 for (int j = 0; j < k; j++) { 32 cin >> c; 33 v[id].push_back(c);//push_back操作一开始写错了 34 } 35 } 36 dfs(1, 0); 37 cout << ...
代码(C GCC 4.72,满分通过): #include"stdafx.h"#include<stdio.h>#include<string.h>#include<math.h>intchar_int(chara){inti=(a-'0');returni;}int*NumgroupCharToInt(char*a,intn,int*b){inti;for(i=0;i<n;i++){b[i]=char_int(a[i]);}returnb;}intaddallnum(int*p,intn){inti;i...
PAT 1004 Counting Leaves (30分) 题目 A family hierarchy is usually presented by a pedigree tree. Your job is to count those family members who have no child. Input Specification: Each input file contains one test case. Each case starts with a line containing 0<N<100, the number of ...
PAT 1004是什么? PAT 1004如何解决? PAT 1004有哪些应用场景? A family hierarchy is usually presented by a pedigree tree. Your job is to count those family members who have no child. Input Each input file contains one test case. Each case starts with a line containing 0 < N < 100, the ...
1. whereIDis a two-digit number representing a given non-leaf node,Kis the number of its children, followed by a sequence of two-digitID's of its children. For the sake of simplicity, let us fix the root ID to be01. The input ends with N being 0. That case must NOT be processe...
柳神题解github.com/liuchuo/PAT/tree/master/AdvancedLevel_C%2B%2B 最后,理想是美好的,但实际可能会遇到各种各样的问题。大家加油! 刷题笔记 part0 关于常见套路和埋坑的总结 todo0:总结刷题过程中遇到的各式各样的问题,比如各类头文件的使用,debug的经验,一些细节导致的难以调试的问题 ...
1004成绩排名(20分) 读入 n(>0)名学生的姓名、学号、成绩,分别输出成绩最高和成绩最低学生的姓名和学号。 输入格式: 每个测试输入包含 1 个测试用例,格式为 第 1 行:正整数... 其中姓名和学号均为不超过 10 个字符的字符串,成绩为 0 到 100 之间的一个整数,这里保证在一组测试用例中没有两个学生的成...
标号标题通过提交通过率 1001A+B和C (15)3607615045323% 1002数字分类 (20)2238810628421% 1003数素数 (20)1985210430619% 1004福尔摩斯的约会 (20)150926404623% 1005德才论 (25)115503739130% 10061016. 部分A+B (15)143952854750% 1007A除以B (20)132472848946% ...