![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
algorithm
风扇吱呀吱呀吹
i am a chinese!
展开
-
PAT(甲级)2020年春季考试 7-4 Replacement Selection (30分)
7-4 Replacement Selection (30分)When the input is much too large to fit into memory, we have to do external sorting instead of internal sorting. One of the key steps in external sorting is to generate sets of sorted records (also called runs) with limited原创 2020-08-04 14:18:14 · 1020 阅读 · 1 评论 -
PAT(甲级)2020年春季考试 7-3 Safari Park (25分)
7-3 Safari Park (25分)A safari park(野生动物园)has K species of animals, and is divided into N regions. The managers hope to spread the animals to all the regions, but not the same animals in the two neighboring regions. Of course, they also realize that this i原创 2020-08-03 22:22:24 · 447 阅读 · 0 评论 -
PAT(甲级)2020年春季考试 7-2 The Judger (25分)
A game of numbers has the following rules: at the beginning, two distinct positive integers are given by the judge. Then each player in turn must give a number to the judge. The number must be the difference of two numbers that are previously given, and mu原创 2020-08-03 22:02:47 · 458 阅读 · 1 评论 -
浙江大学 计算机与软件学院 2019年保研 上机 模拟练习 7-2 Zigzag Sequence(25分)
This time your job is to output a sequence of N positive integers in a zigzag format with width M in non-decreasing order. A zigzag format is to fill in the first row with M numbers from left to right...原创 2019-10-15 21:44:58 · 278 阅读 · 0 评论 -
浙江大学 计算机与软件学院 2019年保研 上机 模拟练习 7-1 Happy Numbers (20 分)
7-1 Happy Numbers (20 分)A happy number is defined by the following process: Starting with any positive integer, replace the number by the sum of the squares of its digits in base-ten, and repeat the ...原创 2019-10-15 21:35:40 · 349 阅读 · 0 评论 -
PAT-A 1148 Werewolf - Simple Version (20 分)
PAT-A 1148 Werewolf - Simple Version (20 分)//狼人杀,考察逻辑.//解决办法:暴力固定变量(两个狼人),讨论在此变量下能否满足题意(说谎的人是谁?怎么去判断说谎:(他是狼你说不是你就说谎了))#include #include #include using namespace std;int n;int main(){cin>&g...原创 2019-09-06 10:55:29 · 133 阅读 · 0 评论 -
7-3 Unsuccessful Searches (25 分)
主要考察散列表平均查找失败长度,掌握概念也就不难了#include <iostream>#include <vector>using namespace std;int main() { int tsize,m,n,num; cin>>tsize>>m>>n; vector<int> rec(tsize,-1);...原创 2019-09-06 21:54:41 · 440 阅读 · 0 评论 -
浙江大学2019年机试 7-1 Conway's Conjecture
考察字符串+素数判断+质因子分解解决办法:循环找到n的最小因子>=2,用map记录次数,最后遍历map组装string,判断是素数即可注意点:n可能大于int范围,用long long#include <iostream>#include <cmath>#include <map>using namespace std;bool isprim...原创 2019-09-07 14:09:10 · 477 阅读 · 0 评论 -
浙江大学2019年机试 7-2 Play with Linked List (25 分)
考察:链表排序,或按指定顺序输出解决办法,先按顺序把有效节点存入rec数组,再按指定顺序,借用vector可依次push或insert,最后遍历即可注意点:可能存在无效节点#include <iostream>#include <cmath>#include <vector>using namespace std;const int maxn = ...原创 2019-09-07 14:12:51 · 592 阅读 · 1 评论