上一页 1 ··· 8 9 10 11 12
摘要: 树与图的存储 邻接矩阵:g[a][b]存储边a→b 邻接表:对于每个点k,开一个单链表,存储k所有可以走到的点。h[k]存储这个单链表的头节点 int h[N],e[N],idx,ne[N]; //添加一条边a->b void add(int a,int b){ e[idx]=b,ne[idx]=h 阅读全文
posted @ 2023-02-06 00:15 bible_w 阅读(10) 评论(0) 推荐(0) 编辑
摘要: Day1 2023牛客寒假算法基础集训营4 A—清楚姐姐学信息论 思路:比较pow(x, y)和pow(y, x)大小 #include <bits/stdc++.h> using namespace std; int main() { long long int a, g,n; cin >> a 阅读全文
posted @ 2023-01-30 21:12 bible_w 阅读(12) 评论(0) 推荐(0) 编辑
摘要: SMU Winter 2023 Round #5 (Div.2) Lucky? int main(){ int t,a[6]; cin>>t; while(t--){ scanf("%1d%1d%1d%1d%1d%1d",&a[0],&a[1],&a[2],&a[3],&a[4],&a[5]); i 阅读全文
posted @ 2023-01-17 01:24 bible_w 阅读(20) 评论(0) 推荐(0) 编辑
摘要: 蓝桥杯模拟赛 2 [蓝桥杯 2020 省 AB1] 解码 思路:当下几个字符组成数字n,输出n个当前字符,否则直接输出 string a,ans; cin>>a; for(int i=0;i<a.size();++i){ if(i<a.size()-1&&a[i]>=65&&a[i+1]<65){ 阅读全文
posted @ 2023-01-09 19:34 bible_w 阅读(30) 评论(0) 推荐(0) 编辑
摘要: [语言月赛202212] 不可以,总司令 思路:比较大小 if(x>y)cout<<"NO"; else if(x<y)cout<<"YES"; else cout<<"equal probability"; [语言月赛202212] 计算 思路:n的各位数字和的值,平方,立方 while(n){ 阅读全文
posted @ 2023-01-07 20:07 bible_w 阅读(54) 评论(0) 推荐(0) 编辑
摘要: SMU Winter 2023 Round #2 (Div.2) 1760A - Medium Number 思路:排列后,输出第二大的数 int main(){ int t,a[5]; cin>>t; while(t--){ for(int i=0;i<3;++i){ cin>>a[i]; } s 阅读全文
posted @ 2023-01-07 15:39 bible_w 阅读(28) 评论(0) 推荐(0) 编辑
摘要: [蓝桥杯 2013 省 B] 带分数 题意:给n,使满足式子a+b/c=n,其中a,b,c共同恰好由1,2...9组成,求a,b,c的取值种数 思路1:枚举出9个数的全排列(可使用next_permutation() ),再用两重循环暴力分解出三段,每段分别代表a,b,c,若满足式子则计数 注意:判 阅读全文
posted @ 2023-01-03 21:19 bible_w 阅读(72) 评论(0) 推荐(0) 编辑
上一页 1 ··· 8 9 10 11 12