上一页 1 2 3 4 5 6 ··· 10 下一页
摘要: 一道非常好的进制题 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 秋月桐 阅读(22) 评论(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 秋月桐 阅读(12) 评论(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 秋月桐 阅读(4) 评论(0) 推荐(0) 编辑
摘要: 一. 单源最短路问题 Dijkstra(基于贪心) A.边权为正 储存图的数据结构:邻接表(稀疏图)或邻接矩阵(稠密图) 算法需要的基本数据结构: 1.Set 集合 (实际用bool数组代替)用于存放已求得最短路径的顶点 2.dist[] : 存放对应顶点到源点的最短路径,初始态仅源点邻居存在有值, 阅读全文
posted @ 2022-04-29 22:59 秋月桐 阅读(21) 评论(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 秋月桐 阅读(12) 评论(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 秋月桐 阅读(17) 评论(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 秋月桐 阅读(7) 评论(0) 推荐(0) 编辑
摘要: 1004 Counting Leaves (30 分) https://pintia.cn/problem-sets/994805342720868352/problems/994805521431773184 测试点3一直过不去不清楚为什么,检查了很久没检查出来,不过bfs记录层数还是很重要的。好 阅读全文
posted @ 2022-04-21 00:04 秋月桐 阅读(57) 评论(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 秋月桐 阅读(12) 评论(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 秋月桐 阅读(13) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 ··· 10 下一页