- 博客(1416)
- 资源 (2)
- 收藏
- 关注
原创 1133 Splitting A Linked List (25分)
1133Splitting A Linked List(25分)Given a singly linked list, you are supposed to rearrange its elements so that all the negative values appear before all of the non-negatives, and all the values in [0, K] appear before all those greater than K. The orde..
2020-05-11 20:32:31
218
原创 1124 Raffle for Weibo Followers (20分)
1124Raffle for Weibo Followers(20分)John got a full mark on PAT. He was so happy that he decided to hold a raffle(抽奖) for his followers on Weibo -- that is, he would select winners from every N followers who forwarded his post, and give away gifts. Now ..
2020-05-11 19:51:21
231
原创 1115 Counting Nodes in a BST (30分)
1115Counting Nodes in a BST(30分)A Binary Search Tree (BST) is recursively defined as a binary tree which has the following properties:The left subtree of a node contains only nodes with keys less than or equal to the node's key. The right subtree of..
2020-05-10 20:44:30
221
原创 1118 Birds in Forest (25分)
1118Birds in Forest(25分)Some scientists took pictures of thousands of birds in a forest. Assume that all the birds appear in the same picture belong to the same tree. You are supposed to help the scientists to count the maximum number of trees in the f..
2020-05-10 19:59:38
247
原创 1117 Eddington Number (25分)
1117Eddington Number(25分)British astronomer Eddington liked to ride a bike. It is said that in order to show off his skill, he has even defined an "Eddington number",E-- that is, the maximum integerEsuch that it is forEdays that one rides more th...
2020-05-10 19:40:11
228
原创 1114 Family Property (25分)
1114Family Property(25分)This time, you are supposed to help us collect the data for family-owned property. Given each person's family members, and the estate(房产)info under his/her own name, we need to know the size of each family, and the average area ..
2020-05-09 19:56:27
222
原创 1142 Maximal Clique (25分)
1142Maximal Clique(25分)Acliqueis a subset of vertices of an undirected graph such that every two distinct vertices in the clique are adjacent. Amaximal cliqueis a clique that cannot be extended by including one more adjacent vertex. (Quoted fromht...
2020-05-09 19:33:15
249
翻译 1111 Online Map (30分)
1111Online Map(30分)Input our current position and a destination, an online map can recommend several paths. Now your job is to recommend two paths to your user: one is the shortest, and the other is the fastest. It is guaranteed that a path exists for ..
2020-05-09 12:55:14
203
原创 1113 Integer Set Partition (25分)
1113Integer Set Partition(25分)Given a set ofN(>1) positive integers, you are supposed to partition them into two disjoint setsA1andA2ofn1andn2numbers, respectively. LetS1andS2denote the sums of all the numbers inA1...
2020-05-09 00:11:06
180
原创 1122 Hamiltonian Cycle (25分)
1122Hamiltonian Cycle(25分)The "Hamilton cycle problem" is to find a simple cycle that contains every vertex in a graph. Such a cycle is called a "Hamiltonian cycle".In this problem, you are supposed to tell if a given cycle is a Hamiltonian cycle.I..
2020-05-08 23:49:08
170
原创 1121 Damn Single (25分)
1121Damn Single(25分)"Damn Single (单身狗)" is the Chinese nickname for someone who is being single. You are supposed to find those who are alone in a big party, so they can be taken care of.Input S...
2020-05-07 13:36:47
211
原创 1120 Friend Numbers (20分)
1120Friend Numbers(20分)Two integers are called "friend numbers" if they share the same sum of their digits, and the sum is their "friend ID". For example, 123 and 51 are friend numbers since 1+2+3...
2020-05-07 12:53:52
220
原创 1152 Google Recruitment (20分)
1152Google Recruitment(20分)In July 2004, Google posted on a giant billboard along Highway 101 in Silicon Valley (shown in the picture below) for recruitment. The content is super-simple, a URL con...
2020-05-07 12:42:20
400
原创 1150 Travelling Salesman Problem (25分)
1150Travelling Salesman Problem(25分)The "travelling salesman problem" asks the following question: "Given a list of cities and the distances between each pair of cities, what is the shortest possi...
2020-05-07 12:22:29
304
原创 1146 Topological Order (25分)
1146Topological Order(25分)This is a problem given in the Graduate Entrance Exam in 2018: Which of the following is NOT a topological order obtained from the given directed graph? Now you are suppo...
2020-05-06 09:30:38
296
原创 1144 The Missing Number (20分)
1144The Missing Number(20分)Given N integers, you are supposed to find the smallest positive integer that is NOT in the given list.Input Specification:Each input file contains one test case. Fo...
2020-05-06 08:57:39
198
原创 1128 N Queens Puzzle (20分)
1128N Queens Puzzle(20分)The "eight queens puzzle" is the problem of placing eight chess queens on an8×8chessboard so that no two queens threaten each other. Thus, a solution requires that no two...
2020-05-06 08:34:58
239
原创 1148 Werewolf - Simple Version (20分)
1148Werewolf - Simple Version(20分)Werewolf(狼人杀) is a game in which the players are partitioned into two parties: the werewolves and the human beings. Suppose that in a game,player #1 said: "Play...
2020-05-06 01:17:44
278
原创 1132 Cut Integer (20分)
1132Cut Integer(20分)Cutting an integer means to cut a K digits lone integer Z into two integers of (K/2) digits long integers A and B. For example, after cutting Z = 167334, we have A = 167 and B ...
2020-05-06 00:57:18
250
原创 1140 Look-and-say Sequence (20分)
1140Look-and-say Sequence(20分)Look-and-say sequence is a sequence of integers as the following:D, D1, D111, D113, D11231, D112213111, ...whereDis in [0, 9] except 1. The (n+1)st number is ...
2020-05-06 00:45:05
205
原创 1149 Dangerous Goods Packaging (25分)
1149Dangerous Goods Packaging(25分)When shipping goods with containers, we have to be careful not to pack some incompatible goods into the same container, or we might get ourselves in serious troub...
2020-05-05 00:04:20
192
原创 1116 Come on! Let's C (20分)
1116Come on! Let's C(20分)"Let's C" is a popular and fun programming contest hosted by the College of Computer Science and Technology, Zhejiang University. Since the idea of the contest is for fun,...
2020-05-03 23:59:26
174
原创 1112 Stucked Keyboard (20分)
1112Stucked Keyboard(20分)On a broken keyboard, some of the keys are always stucked. So when you type some sentences, the characters corresponding to those keys will appear repeatedly on screen for...
2020-05-03 23:25:42
170
原创 1110 Complete Binary Tree (25分)
1110Complete Binary Tree(25分)Given a tree, you are supposed to tell if it is a complete binary tree.Input Specification:Each input file contains one test case. For each case, the first line gi...
2020-05-02 16:42:22
254
原创 1105 Spiral Matrix (25分)
1105Spiral Matrix(25分)This time your job is to fill a sequence ofNpositive integers into aspiral matrixin non-increasing order. A spiral matrix is filled in from the first element at the upper...
2020-05-02 16:13:42
184
原创 1109 Group Photo (25分)
1109Group Photo(25分)Formation is very important when taking a group photo. Given the rules of formingKrows withNpeople as the following: The number of people in each row must beN/K(round ...
2020-05-02 15:43:52
437
原创 7-1 Knuth洗牌法
#include <bits/stdc++.h>using namespace std;const int maxn=1010;int a[maxn];int main(){ int n; cin>>n; for(int i=1; i<=n; i++) { a[i]=i; } for...
2020-05-01 20:38:43
238
原创 7-2 三阶幸福数
#include <bits/stdc++.h>using namespace std;const int maxn=1010;int a[maxn];int main(){ int n; cin>>n; for(int i=1; i<=n; i++) { int x; cin&g...
2020-05-01 20:38:27
370
原创 7-3 垃圾分类
#include <bits/stdc++.h>using namespace std;int main(){ char s[100001]; int l; int n; scanf("%d",&n); map<string,int>q; for(int i=1; i<=n; i++) ...
2020-05-01 20:38:11
770
1
原创 结果填空:爬楼梯
#include <bits/stdc++.h>using namespace std;int main(){ int arr[11]; arr[5] = arr[7] = 0; arr[1] = 1; arr[2] = 2; arr[3] = 4; arr[4] = 8; for (int i = 6; i <= 10; ++i){ if ...
2020-05-01 17:44:55
922
原创 蒜头君爬楼梯(2)
#include<bits/stdc++.h>using namespace std;const int mod=100007;int a[10101];int main(){ int n; cin>>n; a[0]=1; for(int i=1; i<=n; i++) { a[i]=0; ...
2020-05-01 17:34:53
568
原创 蒜头君爬楼梯(1)
#include<bits/stdc++.h>using namespace std;const int mod=100007;int a[10101];int main(){ int n; cin>>n; a[1]=1; a[2]=2; for(int i=3; i<=n; i++) { ...
2020-05-01 17:20:40
596
原创 蒜头君的秘密文件
#include<bits/stdc++.h>using namespace std;const int maxn=1001;int dp[maxn][maxn];int main(){ string a,b; cin>>a>>b; for(int i=1; i<=a.length(); i++) ...
2020-04-30 20:42:04
330
原创 蒜头君的日志
#include<bits/stdc++.h>using namespace std;const int maxn=1001;int dp[maxn][maxn];int a[maxn];int b[maxn];int main(){ int n,m; cin>>n>>m; for(int i=1; i<=n; ...
2020-04-30 20:36:44
379
原创 回文串
#include<bits/stdc++.h>using namespace std;const int maxn=3001;int dp[maxn][maxn];int main(){ string s; cin>>s; int len=s.length(); for(int i=1; i<=len; i++) ...
2020-04-30 20:28:08
156
原创 最长公共子序列
#include<bits/stdc++.h>using namespace std;const int maxn=11001;int dp[maxn][maxn];int main(){ string a,b; memset(dp,0,sizeof(dp)); cin>>a>>b; int lena=a.s...
2020-04-30 20:22:08
145
原创 1127 ZigZagging on a Tree (30分)
1127ZigZagging on a Tree(30分)Suppose that all the keys in a binary tree are distinct positive integers. A unique binary tree can be determined by a given pair of postorder and inorder traversal se...
2020-04-30 19:51:39
217
翻译 vs2019 安装到非系统盘
我的SSD只有120G,装完一些必备的东西就不够用了。vs2019 正式版发布的时候,把旧版的VS卸了,瞬间空出30G。。第一步从微软官网下载 Visual Studio Community 2019(其他版本类似) 运行下载的安装程序,到选择安装的组件时退出程序第二步:使用 mklink 创建链接原理:这一步的目的是欺骗 VS 安装程序,把它(将要或已经)放在系统盘的内容...
2020-04-29 10:21:55
24885
18
原创 1108 Finding Average (20分)
1108Finding Average(20分)The basic task is simple: givenNreal numbers, you are supposed to calculate their average. But what makes it complicated is that some of the input numbers might not be le...
2020-04-28 19:14:41
273
第1章算法竞赛概述.ppt
2019-05-25
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅