advanced_pat
文章平均质量分 85
RelaxRandi
dream it possible.
展开
-
1012 The Best Rank (25)(25 point(s))
To evaluate the performance of our first year CS majored students, we consider their grades of three courses only: C - C Programming Language, M - Mathematics (Calculus or Linear Algebra), and E - Eng...原创 2018-08-10 11:09:51 · 192 阅读 · 0 评论 -
1013 Battle Over Cities (25 分)
A1013考点:连通集的个数#include<cstdio>#include<vector>#include<cstring>using namespace std;const int maxn=1010;const int INF=1000000000;int N, M, K;int d[maxn][maxn], visit[maxn]...原创 2019-02-25 14:49:22 · 461 阅读 · 0 评论 -
1099 Build A Binary Search Tree (30 point(s))
A1099#include<cstdio> #include<algorithm>#include<queue>using namespace std;const int maxn=1010;int in[maxn];int N;struct Node{ int left, right; int key;}p[maxn];int in...原创 2019-02-25 09:45:19 · 145 阅读 · 0 评论 -
1082 Read Number in Chinese (25 分)
A1082#include <cstdio>#include<cstring>int main() { char num[][10]={"ling","yi","er","san","si","wu","liu","qi","ba","jiu"原创 2019-02-28 11:17:47 · 281 阅读 · 0 评论 -
1087 All Roads Lead to Rome (30 point(s))
A1087#include<cstdio>#include<string>#include<map>#include<iostream>using namespace std;const int maxn=1010;const int INF=1000000000;int N, K;map<string, int>s...原创 2019-02-23 21:50:09 · 295 阅读 · 2 评论 -
1018 Public Bike Management (30 point(s))
A1018#include<cstdio>#include<iostream>#include<vector>#include<cmath>using namespace std;const int maxn=1010;const int INF=0x3fffffff;int C, N, S, M;int G[maxn][max...原创 2019-02-23 14:21:58 · 196 阅读 · 0 评论 -
1076 Forwards on Weibo (30 分)
#include<cstdio>#include<algorithm>#include<queue>#include<cstring>using namespace std;const int maxn=1010;int N, L;int inque[maxn];struct Node{ int layer; vector<...原创 2019-02-27 17:32:59 · 308 阅读 · 0 评论 -
1075 PAT Judge (25 point(s))
The ranklist of PAT is generated from the status list, which shows the scores of the submissions. This time you are supposed to generate the ranklist for PAT.Input Specification:Each input file co...原创 2019-02-10 15:10:18 · 148 阅读 · 0 评论 -
1098 Insertion or Heap Sort (25 point(s))
解法一:#include<cstdio>#include<algorithm>using namespace std;const int maxn=1010;int N;int start[maxn], target[maxn];void adjust(int low, int high, int A[]){ int i=low, j=i*2; whi...原创 2019-02-21 13:40:45 · 113 阅读 · 0 评论 -
1031 Hello World for U (20 point(s))
Given any string of N (≥5) characters, you are asked to form the characters into the shape of U. For example, helloworld can be printed as:h de ll rlowoThat is, the characters must be prin...原创 2019-01-22 17:02:03 · 177 阅读 · 0 评论 -
1024 Palindromic Number(25 point(s))
A number that will be the same when it is written forwards or backwards is known as a Palindromic Number. For example, 1234321 is a palindromic number. All single digit numbers are palindromic numbers...原创 2018-08-28 11:21:08 · 140 阅读 · 0 评论 -
1089 Insert or Merge(25 point(s))
According to Wikipedia:Insertion sort iterates, consuming one input element each repetition, and growing a sorted output list. Each iteration, insertion sort removes one element from the input data,...原创 2018-08-17 10:32:17 · 251 阅读 · 0 评论 -
1059 Prime Factors (25)(25 point(s))
Given any positive integer N, you are supposed to find all of its prime factors, and write them in the format N = p1^k1* p2^k2 *…*pm^km.Input Specification:Each input file contains one test case w...原创 2018-08-22 08:56:09 · 147 阅读 · 0 评论 -
1044 Shopping in Mars (25)(25 point(s))
Shopping in Mars is quite a different experience. The Mars people pay by chained diamonds. Each diamond has a value (in Mars dollars M). When making the payment, the chain can be cut at any position f...原创 2018-08-15 17:04:57 · 156 阅读 · 0 评论 -
1035 Password (20)(20 point(s))
To prepare for PAT, the judge sometimes has to generate random passwords for the users. The problem is that there are always some confusing passwords since it is hard to distinguish 1 (one) from l (L ...原创 2018-08-08 11:12:30 · 120 阅读 · 0 评论 -
1048 Find Coins (25)(25 point(s))
Eva loves to collect coins from all over the universe, including some other planets like Mars. One day she visited a universal shopping mall which could accept all kinds of coins as payments. However,...原创 2018-08-11 19:26:08 · 330 阅读 · 0 评论 -
1084 Broken Keyboard (20)(20 point(s))
On a broken keyboard, some of the keys are worn out. So when you type some sentences, the characters corresponding to those keys will not appear on screen.Now given a string that you are supposed to...原创 2018-08-11 10:58:54 · 124 阅读 · 0 评论 -
1080 Graduate Admission (30)(30 point(s))
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 admissio...原创 2018-08-11 09:17:43 · 116 阅读 · 0 评论 -
1146 Topological Order (25 分)
A1146#include<cstdio>#include<iostream>#include<algorithm>#include<vector>using namespace std;const int maxn=1010;int N, M, K;vector<int>G[maxn];int indegree[m...原创 2019-02-27 11:26:04 · 272 阅读 · 0 评论