pat考试

paeamecium5 天前
数据结构·c++·算法·pat考试
【PAT甲级真题】- Longest Symmetric String (25)Longest Symmetric String (25)Given a string, you are supposed to output the length of the longest symmetric sub-string. For example, given “Is PAT&TAP symmetric?”, the longest symmetric sub-string is “s PAT&TAP s”, hence you must output 11.
paeamecium6 天前
数据结构·c++·算法·pat考试
【PAT】 - Course List for Student (25)Course List for Student (25)题目描述点击链接自行查看注意点:Zhejiang University has 40000 students and provides 2500 courses. Now given the student name lists of all the courses, you are supposed to output the registered course list for each student who comes for a query
paeamecium9 天前
数据结构·c++·算法·pat考试·pat
【PAT甲级真题】- Linked List Sorting (25)Linked List Sorting (25)题目描述点击链接自行查看注意点:一开始还在想写一个静态链表的归并排序 然后发现合并的时候不知道怎么复制。。。 后面反应过来发现好像根本不用自己写
paeamecium9 天前
数据结构·c++·算法·list·pat考试
【PAT甲级真题】- Student List for Course (25)Student List for Course (25)](https://www.nowcoder.com/pat/5/problem/4086)
1231566801 个月前
c语言·数据结构·算法·pat考试
PAT 1017 A除以B本题要求计算 A/B,其中 A 是不超过 1000 位的正整数,B 是 1 位正整数。你需要输出商数 Q 和余数 R,使得 A=B×Q+R 成立。
剪一朵云爱着3 个月前
算法·pat考试
PAT 1095 Cars on Campus这一题的大意是说给出N条记录,这N条记录里面有进入停车场的也有出停车场的,现在我们要做的是给出K条询问,问在某一个时刻,有多少辆车在这个停车场中,在一天内停在停车场中时间最长的车牌号是多少,如果有多个,按照车牌号从小到大输出。 在这一题中给出的记录是不按照时间顺序的,而题目要求必须保证一条进入的记录和一条出去的记录相匹配,如果不存在相匹配的记录,那么这个记录就该被忽略, 因此如何确定哪些记录是相匹配的是第一要务。 我们可以通过进行自定义排序,先按照车牌大小排序,再按照时间大小排序这样我们就把同一辆车的相近
准女婿_3 个月前
pat考试
优考试局域网系统V6.0.0机构版keyGen优考试局域网系统迎来V6.0.0版本更新,核心在于提升功能性能与优化操作体验。重点对学情分析、移动端考试支持、考试监控和答题体验等方面进行了实用性更新,进一步提升了局域网环境下考试系统的灵活性与管理效率。
剪一朵云爱着4 个月前
算法·pat考试
PAT 1056 Mice and Rice这一题的大意是说Np个老鼠参加比赛,相邻Ng个分成一组进行选拔,每组中选择最重的老鼠晋级,没有晋级的老鼠的排名一个样,按照这种思路给所有的老鼠进行排名,如果最后剩下不足Ng个仍可以分成一组,排名是跟分组个数相关。 这一题最开始我不理解的就是怎么确定排名,后来才明白,先算出当前的组数,然后排名等于组数+1,用测试样例验证是符合的。我们可以采用队列按照题目要求的顺序来保存老鼠的体重和索引,然后对一个个出队,在出队的过程中,我们找最大的体重和与之对应的索引,同时给老鼠排名,每Ng个我们把这Ng个中最重的老师,保
仰泳的熊猫4 个月前
数据结构·c++·算法·pat考试
1109 Group Photo#include<iostream> #include<vector> #include<algorithm> using namespace std; int n,k; struct node{ string name; int height; }; bool cmp(struct node a,struct node b){ return a.height!=b.height?a.height>b.height:a.name<b.name; } int main(){ cin>>n>>k; int m
剪一朵云爱着4 个月前
算法·pat考试
PAT 1091 Acute Stroke这一题的大意是说给出一个三维的矩阵,让我们找上下左右前后相互连通,面积大于等于T的数量,统计最终的面积。 看懂题目后实际上还是比较好写的。 我一开始无脑DFS搜索,找连通块 但写好代码后发现最后两个测试点段错误 DFS代码如下:
仰泳的熊猫4 个月前
数据结构·c++·算法·pat考试
1150 Travelling Salesman Problem#include<iostream> #include<set> #include<vector> using namespace std; //定义全局变量 int n,m,k,e[300][300]; int ansid;//最短路径的查询编号 int ans=999999999;//最短路径初始化
仰泳的熊猫4 个月前
数据结构·c++·算法·pat考试
1154 Vertex Coloring#include<iostream> #include<set> #include<vector> using namespace std;
仰泳的熊猫4 个月前
数据结构·c++·算法·pat考试
1149 Dangerous Goods Packaging#include <iostream> #include <vector> #include <map> using namespace std;
剪一朵云爱着4 个月前
算法·pat考试
PAT 1158 Telefraud Detection这一题的大意是说,给出M个通话记录,让我们找嫌疑人,一个人如果超过K次短通话记录给不同的人每天,但是不超过20%的人打回来,那么它就是一个嫌疑人,而且如果两个怀疑的人互相打电话我们认为他们可能属于团伙 短通话是指总时长不超过5分钟.最后需要把属于一个团伙按照编号从小到大的顺序输出。不同的团伙也按照从编号从小到大的顺序输出。 题目中的数据范围比较小,模拟这个过程并不难:
仰泳的熊猫4 个月前
数据结构·c++·算法·pat考试
1083 List Grades#include <iostream> #include <vector> #include <algorithm> using namespace std;
仰泳的熊猫4 个月前
数据结构·c++·算法·pat考试
1037 Magic Coupon#include<iostream> #include<vector> #include<algorithm> using namespace std; int main(){ int ans=0; //处理优惠券 int n; cin>>n; vector<int>v1(n); for(int i=0;i<n;i++){ cin>>v1[i]; } //处理商品 int m; cin>>m; vector<int>v2(m); for(int i=0;i<m;i++){ cin>>v2[i]; } //
仰泳的熊猫4 个月前
数据结构·c++·算法·pat考试
1094 The Largest Generation#include<iostream> #include<vector> using namespace std; vector<int>v[100];//邻接表,存储树结构 int book[100]={0};//记录每层节点数 //dfs,统计每层节点数 void dfs(int index,int level){ book[level]++; for(int i=0;i<v[index].size();i++){//遍历此节点的左右子节点 dfs(v[index][i],level+1);//当全部遍
仰泳的熊猫4 个月前
数据结构·c++·算法·pat考试
1077 Kuchiguse#include<iostream> #include<string> #include<algorithm> using namespace std; int main(){ int n; cin>>n; cin.ignore(); string ans; for(int i=0;i<n;i++){ string s; getline(cin,s); reverse(s.begin(),s.end()); if(i==0){ ans=s; continue; }else{//让较短的字符串作为标准 if
仰泳的熊猫4 个月前
数据结构·c++·算法·pat考试
1108 Finding Average#include<iostream> #include<string> #include<cstring> // strlen() #include<cstdio> #include<iomanip> using namespace std;
仰泳的熊猫4 个月前
数据结构·c++·算法·pat考试
1112 Stucked Keyboard#include<iostream> #include<map> #include<set> #include<string> using namespace std; bool sureNobroken[256]; int main(){ int k,cnt=1; cin>>k;//字符出现次数的阈值 string s; cin>>s;