1047 Student List for Course Zhejiang University has 40,000 students and provides 2,500 courses. Now given the registered course list of each student, you are supposed to output the student name lists of all the courses. Input Specification: Each inp…
准备每天刷两题PAT真题.(一句话题解) 1001 A+B Format  模拟输出,注意格式 #include <cstdio> #include <cstring> #include <iostream> #include <algorithm> using namespace std; string ans = ""; int main() { ; cin >> a >> b; c = a + b; ) {…
1080 Graduate Admission--PAT甲级练习题 It is said that in 2013, there were about 100 graduate schools ready to proceed over 40,000 applications in Zhejiang Province. It would help a lot if you could write a program to automate the admission procedure. Eac…
正好这个"水水"的C4来了 先把甲级刷完吧.(开玩笑-2017.3.26) 这是一套"伪题解". wacao 刚才登出账号测试一下代码链接,原来是看不到..有空弄题(xia)解(che).. //"今天"的"收获": BST的中序遍历特性:栈那题利用树状数组+二分维护:哇咔咔,题意真难,根据案例猜题意.好吧,反正我又不考.不如睡觉? 出现了基础的二级最短路: 对DFS联通快愣了一下.. 哇塞呀!模拟题还是很劲的! 哇塞呀,手写…
题目概述:Programming Ability Test (PAT) is organized by the College of Computer Science and Technology of Zhejiang University. Each test is supposed to run simultaneously in several places, and the ranklists will be merged immediately after the test. Now…
2019/4/3 1063 Set Similarity n个序列分别先放进集合里去重.在询问的时候,遍历A集合中每个数,判断下该数在B集合中是否存在,统计存在个数(分子),分母就是两个集合大小减去分子. // 1063 Set Similarity #include <set> #include <map> #include <cstdio> #include <iostream> #include <algorithm> using name…
1019. General Palindromic Number 题意:求数N在b进制下其序列是否为回文串,并输出其在b进制下的表示. 思路:模拟N在2进制下的表示求法,“除b倒取余”,之后判断是否回文. #include<iostream> #include<cstdio> using namespace std; ]; int main() { int n, b; scanf("%d%d", &n, &b); , tmp = n,yu=tmp…
题目分析: 由于本题字符串长度有10^5所以直接暴力是不可取的,猜测最后的算法应该是先预处理一下再走一层循环就能得到答案,所以本题的关键就在于这个预处理的过程,由于本题字符串匹配的内容的固定的PAT,所以我们可以这样想,对于一个输入的串,我们找到每个A的位置,只要知道这个A的前面有几个P,这个A的后面有几个T,就可以得到以这个A为中心的所有种数,二者相乘即可,然后如果我们能得到0~s.size()-1范围内每个A的前面有多少个P,每个A后面有多少个T,只要从头遍历一遍并且求和就能得到最终答案,由…
题目: Calculate a + b and output the sum in standard format -- that is, the digits must be separated into groups of three by commas (unless there are less than four digits). Input Each input file contains one test case. Each case contains a pair of int…
题意:有n个人,每个人有k个爱好,如果两个人有某个爱好相同,他们就处于同一个集合.问总共有多少个集合,以及每个集合有多少人,并按从大到小输出. 很明显,采用并查集.vis[k]标记爱好k第一次出现的人的编号,如果为0则表示未出现. 当前第i个人若也存在爱好k,则只要将i与vis[k]两个人合并即可. 最后father[i]相同的即处在同一个集合中. #include <iostream> #include <cstdio> #include <algorithm> #i…