
PAT刷题记录
浙软复试机试准备
weixin_43140251
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
PAT甲级1015 Reversible Primes (20 分)
原题:A reversible prime in any number system is a prime whose "reverse" in that number system is also a prime. For example in the decimal system 73 is a reversible prime because its reverse 37 is also a prime.Now given any two positive integers NNN (<10原创 2021-02-07 11:25:39 · 118 阅读 · 0 评论 -
PAT甲级1014 Waiting in Line (30 分)
原题:Suppose a bank has NNN windows open for service. There is a yellow line in front of the windows which devides the waiting area into two parts. The rules for the customers to wait in line are:The space inside the yellow line in front of each window is原创 2021-02-04 21:17:18 · 125 阅读 · 0 评论 -
PAT甲级1013 Battle Over Cities (25 分)
原题:It is vitally important to have all the cities connected by highways in a war. If a city is occupied by the enemy, all the highways from/toward that city are closed. We must know immediately if we need to repair any other highways to keep the rest of th原创 2021-02-03 21:40:36 · 107 阅读 · 0 评论 -
PAT甲级1010 Radix (25分)
原题:源代码:#include<iostream>#include<string>#include<cmath>using namespace std;string n1, n2;int tag, radix;int resradix = -1;long to10(string s, int r){ long res = 0; for(int i = s.length() - 1; i >= 0; i --){ in原创 2021-02-02 20:02:46 · 239 阅读 · 0 评论 -
PAT甲级1012 The Best Rank (25分)
原题目: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 Algrbra), and E - English. At the mean time, we encourage students by em原创 2021-02-01 21:26:16 · 115 阅读 · 0 评论 -
PAT甲级1011 World Cup Betting (20分)
原题:源代码:#include<iostream>#include<stdio.h>using namespace std;int main(){ double game[3][3]; char c[3] = {'W', 'T', 'L'}; double profit = 1; int tagj[3]; for(int i = 0; i < 3; i ++){ double max = -1;原创 2021-02-01 20:23:29 · 102 阅读 · 0 评论 -
PAT甲级1009 Product of Polynomials (25分)
原题目:源代码:#include<iostream>#include<vector>#include<stdio.h>#include<cmath>using namespace std;struct Ploy{ int n; float a;};float res[1000005];vector<Ploy> x, y;int main(){ int k1, k2; cin>>k1;原创 2021-01-30 21:25:30 · 206 阅读 · 2 评论 -
PAT甲级1008 Elevator (20分)
原题:源代码:#include<iostream>using namespace std;int main(){ int n; cin>>n; int timelist[n]; for(int i = 0; i < n; i ++) cin>>timelist[i]; int sum = 0; int now = 0; for(int i = 0; i < n; i ++){原创 2021-01-28 19:39:04 · 102 阅读 · 0 评论 -
PAT甲级1007 Maximum Subsequence Sum (25分)
原题:思路:dp核心代码:if(num[i] > num[i] + dp[i - 1]) dp[i] = num[i]; else dp[i] = num[i] + dp[i - 1]; if(dp[i] > max){ ma = i; max = dp[i]; }源代码:#include<iostream>using namespace std;int main(){ int N; cin>>N; int n = N;原创 2021-01-28 19:26:27 · 94 阅读 · 0 评论 -
PAT甲级1006 Sign In and Sign Out (25分)
原题目:源代码:#include<iostream>#include<stdio.h>#include<string>#include<algorithm>using namespace std;struct Time{ int hours; int minutes; int seconds;};struct Person{ string id; Time comein; Time comeou原创 2021-01-28 19:22:15 · 91 阅读 · 0 评论 -
PAT甲级1005 Spell It Right (20分)
原题:源代码:#include<iostream>#include<vector>#include<string>using namespace std;string invert[10] = {"zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"};int main(){ string n; vector<int> num;原创 2021-01-26 09:52:59 · 90 阅读 · 0 评论 -
PAT甲级1004 Counting Leaves (30分)
原题:题目大意:一个树,n个节点,m个非叶节点,求出每一层叶节点数。源代码:#include<iostream>#include<queue>using namespace std;int tree[105][105]; //规模不大,直接用数组存树int tchild[105]; //每个节点的孩子数int vis[105]; //访问标志int n, m; //n结点数,m非叶结点数queue<int> q;原创 2021-01-26 09:55:36 · 171 阅读 · 3 评论 -
PAT甲级1003 Emergency (25分)
原题:源代码:在这里插入代码片已AC:易失分点:原创 2021-01-22 20:43:51 · 105 阅读 · 0 评论 -
PAT甲级1002 A+B for Polynomials (25分)
(第一时间的思路,未优化)原题目:源代码:#include<iostream>#include<vector>#include<stdio.h>using namespace std;struct P{ int n; double a;};int main(){ vector<P> x, y, sum; int k; cin >> k; while(k --){ P原创 2021-01-20 20:38:51 · 96 阅读 · 1 评论 -
PAT甲级1001 A+B Format (20分)
源代码:#include<iostream> #include<cmath> using namespace std; int main(){ int x, y, sum; cin>>x>>y; sum = x+y; bool pt = true; if(sum < 0){ pt = false; sum = -sum; } bool flag = false; if(sum >= 1000) flag = true; if(!flag){ if原创 2021-01-20 19:38:39 · 93 阅读 · 0 评论