04 2022 档案

摘要:这题有点复杂,参考了柳神的代码 要搞清楚这里面的结构体 #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 秋月桐 阅读(43) 评论(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)
摘要:一. 单源最短路问题 Dijkstra(基于贪心) A.边权为正 储存图的数据结构:邻接表(稀疏图)或邻接矩阵(稠密图) 算法需要的基本数据结构: 1.Set 集合 (实际用bool数组代替)用于存放已求得最短路径的顶点 2.dist[] : 存放对应顶点到源点的最短路径,初始态仅源点邻居存在有值, 阅读全文
posted @ 2022-04-29 22:59 秋月桐 阅读(72) 评论(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 秋月桐 阅读(29) 评论(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 秋月桐 阅读(23) 评论(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)
摘要:1.先dfs,保存dfs的所有值的o(n)做法 /** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode() : va 阅读全文
posted @ 2022-04-20 19:14 秋月桐 阅读(32) 评论(0) 推荐(0)
摘要:/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode() : val(0), left(nullptr), rig 阅读全文
posted @ 2022-04-19 23:58 秋月桐 阅读(28) 评论(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 秋月桐 阅读(35) 评论(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)