PAT (Advanced Level)
等不是办法,干才有希望。
田园菜菜狗
这个作者很懒,什么都没留下…
展开
-
1118 Birds in Forest (25 分)
#include<bits/stdc++.h> using namespace std; vector<int> father,countn; int findFather(int x){ int a=x; while(x!=father[x]){ x=father[x]; } while(a!=father[a]){ int z=a; a=father[a]; father[z]=x; } return x; } void Union(int a,int原创 2021-03-10 14:10:04 · 58 阅读 · 0 评论 -
1041 Be Unique (20分)
#include<iostream> using namespace std; int main(){ int n; cin>>n; int num[n]; int count[10000]={0}; for(int i=0;i<n;i++){ cin>>num[i]; count[num[i]]++; } int i; for(i=0;i<n;i++){ if(count[num[i]]==1){ cout<<n原创 2021-01-29 20:23:04 · 92 阅读 · 0 评论 -
1019 General Palindromic Number (20分)
#include<iostream> using namespace std; int main(){ int n,b; cin>>n>>b; int num[1000]; int count=0; while(n>0){ num[count]=n%b; n=n/b; count++; } int flag=1; for(int i=0;i<count/2;i++){ if(num[i]!=num[count-i-1]){原创 2021-01-24 19:59:59 · 85 阅读 · 0 评论 -
1012 The Best Rank (25分)
1012 The Best Rank #include<iostream> #include<map> #include<algorithm> using namespace std; struct Student{ string id; int C[2]; int M[2]; int E[2]; int A[2]; }stu[3000]; bool cmp1(Student a,Student b){ return a.C[0]>b.C[0]; }原创 2021-01-24 14:56:44 · 77 阅读 · 0 评论