PAT甲级
PAT甲级
happy life 2022
这个作者很懒,什么都没留下…
展开
-
PAT甲级-1004 Counting Leaves (30 分)
题目链接 #include<iostream> #include<vector> using namespace std; const int N=110; vector<int> v[N]; //树的简化版表示-->类比图的邻接表表示 int leaf[N]={0}; int maxdepth=0; void dfs(int index,int depth){ if(v[index].size()==0){ //到达叶子结点 leaf原创 2021-05-15 16:57:00 · 120 阅读 · 0 评论 -
PAT甲级-1003 Emergency (25 分)
题目链接 #include<iostream> #include<algorithm> using namespace std; const int MAXV=510; const int INF=1000000000; //10^9 int n,m,c1,c2,g[MAXV][MAXV],weigth[MAXV]; int d[MAXV],w[MAXV],num[MAXV]; bool vis[MAXV]={false}; void Dijkstra(int s){原创 2021-05-15 15:30:42 · 129 阅读 · 0 评论 -
PAT甲级-1002 A+B for Polynomials (25 分)
题目链接 #include<iostream> using namespace std; int main(){ float hash[1001]={0}; //指数->系数的映射 int k,n; float a; cin>>k; for(int i=0;i<k;i++){ cin>>n>>a; hash[n]+=a; } cin>>k;原创 2021-05-14 15:35:40 · 63 阅读 · 0 评论