PAT甲级
KK的任意门
改变,从去影响开始。
展开
-
题目二十三
题目:Phone Bills我的代码:#include<iostream>#include<map>#include<algorithm>using namespace std;typedef struct{ string name; map<string,string>time;}consumer;//根据名字排...原创 2020-04-26 14:56:42 · 126 阅读 · 0 评论 -
题目二十二
题目 : Reversible Primes我的代码:#include<iostream>#include<string>#include<algorithm>#include<vector>using namespace std;//判断是否为素数int judge(int a){ if(a <= 2) return...原创 2020-04-20 11:24:42 · 125 阅读 · 0 评论 -
题目二十一:深度遍历和广度遍历、并查集的应用
题目:Battle Over Cities我的代码:#include<iostream>#include<algorithm>#include<queue>#include<cstdio>using namespace std;//返回值为群的个数int BFS(int edge[1001][1001],int visited...原创 2020-04-13 12:02:30 · 174 阅读 · 0 评论 -
题目二十
题目:World Cup Betting我的代码:#include<iostream>#include<cstdio>using namespace std;int main(){ double profit = 1,max = -1000; char type[3] = {'W','T','L'}; int t; fo...原创 2020-04-03 11:38:35 · 135 阅读 · 0 评论 -
题目十九---用二分法解决超大进制数问题
题目:Radix我的代码:#include<iostream>#include<string>#include<algorithm>using namespace std;//找出数字串中最大的那个数字int getmax(string s){ int max = -1; for(size_t i = 0;i < s.siz...原创 2020-04-02 11:48:00 · 156 阅读 · 0 评论 -
题目十八
题目:Elevator我的代码:```cpp#include<iostream>using namespace std;int main(){ int N,f = 0,s = 0,sum = 0; cin>>N; sum += N*5; for(int i = 0;i < N;i++){ cin&...原创 2020-04-01 17:34:05 · 114 阅读 · 0 评论 -
题目十七--经典的动态规划问题
题目:Maximum Subsequence Sum我的代码:#include<iostream>using namespace std;int main(){ int a[10001],dp[10001],N; //dp是第i个元素前面的累加和(包括i) int flag = 0; int max,start,end,s,e; cin&...原创 2020-04-01 16:59:55 · 125 阅读 · 0 评论 -
题目十六
题目:Sign In and Sign Out我的代码:#include<iostream>#include<string>#include<algorithm>using namespace std;typedef struct { string id; string stime; string etime;}pe...原创 2020-03-31 12:48:20 · 117 阅读 · 0 评论 -
题目十五
题目:Spell It Right我的代码:#include<iostream>#include<algorithm>#include<string>#include<vector>using namespace std;int main(){ string s; int sum; vector&l...原创 2020-03-31 12:22:05 · 116 阅读 · 0 评论 -
题目十四
题目:Counting Leaves思路:题目求每一层的叶子节点个数,自己用了层次遍历来做。我的代码:#include<iostream>#include<queue>#include<algorithm>using namespace std;bool cmp(int a,int b){ return a>b;}int...原创 2020-03-29 14:47:32 · 145 阅读 · 0 评论 -
题目十三
题目:Emergency我的代码://ng了70%,求最短路径条数的方法参照了参考代码的,但是也没能通过#include<iostream>#include<vector>using namespace std;int const MaxVertex = 500;#define Vertex int#define EdgeWeight int#de...原创 2020-03-28 21:18:36 · 108 阅读 · 0 评论 -
题目十二
题目:A+B for Polynomials我的代码:#include<iostream>#include<algorithm>#include<cstdio>using namespace std;int main(){ float a[1001] = {0}; int N1,N2,count = 0; c...原创 2020-03-26 12:19:27 · 76 阅读 · 0 评论 -
题目十一
题目:A+B FORMAT我的代码:#include<iostream>#include<string>#include<cstring>#include<algorithm>using namespace std;int main(){ //还有一种思路是用整数和栈来做 long long a,b; ...原创 2020-03-25 12:53:43 · 130 阅读 · 0 评论 -
题目十
题目:Magic Coupon我的代码#include<iostream>#include<algorithm>#include<vector>using namespace std;bool cmp(int a,int b){ if(a < 0 && b < 0) return a < b; el...原创 2020-03-21 23:39:32 · 111 阅读 · 0 评论 -
题目九
题目:Boys vs Girls我的代码:#include<iostream>#include<string>#include<algorithm>using namespace std;typedef struct { string name; string gender; string id; int grade...原创 2020-03-18 23:34:09 · 117 阅读 · 0 评论 -
题目八
题目八:Password我的代码:#include<iostream>#include<string>#include<map>using namespace std;typedef struct { string id; string keyword; int mod;}student;int main(){ ...原创 2020-03-16 23:25:55 · 85 阅读 · 0 评论 -
题目七
题目:无向图中,求图中从src节点到dest节点的最短路径,若最短路径相同,则求最少代价的路径–对于图的算法还不是很熟悉,这道题目当做参考–参考代码一:#include <iostream> #include <string> #include <vector> #include <algorithm> using names...原创 2020-03-16 22:47:09 · 150 阅读 · 0 评论 -
题目六
题目:归并排序,并输出中值我的代码:#include<iostream>using namespace std;int main(){ long len1,len2,i = 1,j = 1,k = 1; long a1[1000001],a2[1000001]; cin>>len1; for(int i = 1;i <= le...原创 2020-03-15 22:21:52 · 117 阅读 · 0 评论 -
题目五
题目:List Sort我的代码:#include<iostream>#include<string>#include<algorithm>using namespace std;typedef struct student{ string id; string name; int point;}stu;bool cm...原创 2020-03-12 23:07:49 · 105 阅读 · 0 评论 -
题目四
题目:The Dominant Color(再给出的颜色里面,占大多数的颜色—默认肯定会超过一半)我的代码#include<iostream>#include<map>using namespace std;int main(){ map<string,int>m; string out; int row,col,max = ...原创 2020-03-11 23:03:10 · 146 阅读 · 0 评论 -
题目三
题目:List Grades我的代码#include<iostream>#include<string>#include<algorithm>using namespace std;typedef struct{ string name; string id; int point;}student;bool cmp(s...原创 2020-03-09 21:03:47 · 105 阅读 · 0 评论 -
题目二
题目:Read Number in Chinese,以中文惯用的读法输出数字我的代码:#include<iostream>#include<string>using namespace std;int main(){ string num[10] = {"ling","yi","er","san","si","wu","liu","qi","ba","j...原创 2020-03-07 23:29:43 · 100 阅读 · 0 评论 -
题目一
题目:Given N rational numbers in the form “numerator/denominator”, you are supposed to calculate their sum.我的代码:链接:https://www.nowcoder.com/questionTerminal/3f9db00a3df04816ae87c370c24ee14c?toCommentI...原创 2020-03-05 23:13:34 · 159 阅读 · 0 评论