随笔分类 -  pat甲级打卡

摘要:一题双解: 1.临界矩阵+dfs 查询二维矩阵邻接分量 // 题目要求:output 指定城市沦陷后需要修复的路的条数 // 图的存储,因为要多次查询两节点是否连接,所以用邻接矩阵,相比邻接表的时间更低 #include<bits/stdc++.h> using namespace std; con 阅读全文
posted @ 2022-05-02 16:35 秋月桐 阅读(47) 评论(0) 推荐(0)
摘要:这题有点复杂,参考了柳神的代码 要搞清楚这里面的结构体 #include<bits/stdc++.h> using namespace std; struct Stu{ int id,best;//best是最好排名的学科index int score[4],rank[4]; }stus[2010] 阅读全文
posted @ 2022-04-30 21:08 秋月桐 阅读(30) 评论(0) 推荐(0)
摘要:简单题 #include<bits/stdc++.h> using namespace std; int main(){ float cnt=1; for(int i=1;i<=3;i++){ float w,t,l; cin>>w>>t>>l; if(w>t && w>l){ cout<<"W " 阅读全文
posted @ 2022-04-30 21:06 秋月桐 阅读(20) 评论(0) 推荐(0)
摘要:一道非常好的进制题 2个精华:x进制转10进制问题,二分问题 #include<bits/stdc++.h> using namespace std; typedef long long LL; LL get(string s,LL b){ LL res=0; for(auto c:s){ if(c 阅读全文
posted @ 2022-04-29 23:07 秋月桐 阅读(44) 评论(0) 推荐(0)
摘要:1002的进阶题 #include<bits/stdc++.h> using namespace std; int k1,k2; map<float,float> m,n; int main(){ cin>>k1; int cnt=0; while(k1--){ float key,val; cin 阅读全文
posted @ 2022-04-29 23:06 秋月桐 阅读(28) 评论(0) 推荐(0)
摘要:简单题 #include<bits/stdc++.h> using namespace std; int n,cnt; int main(){ cin>>n; int pre=0; while(n--){ int tmp; cin>>tmp; if(tmp>pre) cnt+=(tmp-pre)*6 阅读全文
posted @ 2022-04-29 23:04 秋月桐 阅读(15) 评论(0) 推荐(0)
摘要:血的教训记得看清楚题目。。。。调试了几个小时 #include<bits/stdc++.h> using namespace std; const int N=1e4+10; // 前缀和 int a[N],s[N]; int k; int main(){ cin>>k; for(int i=1;i 阅读全文
posted @ 2022-04-21 23:08 秋月桐 阅读(30) 评论(0) 推荐(0)
摘要:#include<bits/stdc++.h> using namespace std; int mina=25,minb=25,minc=25; int maxa=-1,maxb=-1,maxc=-1; string minstr,maxstr; int m; int main(){ cin>>m 阅读全文
posted @ 2022-04-21 22:09 秋月桐 阅读(36) 评论(0) 推荐(0)
摘要:#include<bits/stdc++.h> using namespace std; map<int,string> m={ {0,"zero"}, {1,"one"}, {2,"two"}, {3,"three"}, {4,"four"}, {5,"five"}, {6,"six"}, {7, 阅读全文
posted @ 2022-04-21 22:08 秋月桐 阅读(24) 评论(0) 推荐(0)
摘要:1004 Counting Leaves (30 分) https://pintia.cn/problem-sets/994805342720868352/problems/994805521431773184 测试点3一直过不去不清楚为什么,检查了很久没检查出来,不过bfs记录层数还是很重要的。好 阅读全文
posted @ 2022-04-21 00:04 秋月桐 阅读(75) 评论(0) 推荐(0)
摘要:#include <iostream> #include <cstring> #include <algorithm> using namespace std; const int N = 505; int dis[N],w[N]; bool visit[N]; int e[N][N],weight 阅读全文
posted @ 2022-04-16 23:19 秋月桐 阅读(37) 评论(0) 推荐(0)
摘要:#include<bits/stdc++.h> using namespace std; float c[1001]; int main(){ int k1,k2; cin>>k1; for(int i=1;i<=k1;i++){ float b; int a; cin>>a>>b; c[a]+=b 阅读全文
posted @ 2022-04-16 23:18 秋月桐 阅读(36) 评论(0) 推荐(0)
摘要:#include<bits/stdc++.h> using namespace std; int main(){ int a,b; cin>>a>>b; int res=a+b; string s=to_string(res); int cnt=1; for(int i=s.size()-1;i>= 阅读全文
posted @ 2022-04-16 23:17 秋月桐 阅读(21) 评论(0) 推荐(0)