牛客练习赛
lao_kai_ybqy
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
牛客小白月赛 23
A 膜法记录 看数据行数很少 按照行数贪心,暴搜 题解链接 B 阶乘 题目链接 先判断是否为质数,如果是质数的话,最小的n一定是他本身.如果不是的话就要因式分解了,将他分解为质数,之后用到我们第一句的理论.或者不能再分解. #include<iostream> #include<cstdio> #include<algorithm> #include<cstring> using namespace std; int gcd(int a,int b) {原创 2021-03-17 21:57:14 · 168 阅读 · 0 评论 -
牛客小白月赛 30
A题 并查集或者最小生成树 //并查集 #include<iostream> #include<cstdio> #include<math.h> #include<algorithm> using namespace std; typedef long long ll; const int maxn=2e+5; int f[maxn]; struct node { int x;int y;int w; }e[maxn]; bool cmp(node a原创 2020-12-06 22:37:23 · 122 阅读 · 0 评论 -
牛客小白月赛 21
A Audio 数论,三角形外心,三点到某点距离相等 #include<iostream> #include<math.h> using namespace std; int main() { double x[4],y[4]; for(int i=1;i<=3;i++) cin>>x[i]>>y[i]; double A1,A2,B1,B2,C1,C2; double x1,y1; A1=2*(x原创 2021-01-18 22:59:47 · 221 阅读 · 0 评论 -
牛客小白月赛 20
A 斐波那契 矩阵快速幂 A题题解 B 最大边长 数论思维题,三种情况分析就行 #include<iostream> #include<algorithm> using namespace std; typedef unsigned long long ull; int main() { ull a,b; cin>>a>>b; if(a>=b) swap(a,b); if(3*a<=b) cout<<原创 2021-01-17 22:33:47 · 402 阅读 · 0 评论 -
牛客小白月赛 5
A题 容斥定理 详细题解 #include<iostream> using namespace std; typedef long long ll; const int maxn=100; int k; ll ans[maxn]; ll solve(ll a) { if(a==0) return 0; ll num=a; for(int i=1;i<(1<<k);i++) { int cnt=0; ll mul原创 2020-12-02 22:16:48 · 168 阅读 · 0 评论 -
牛客小白月赛3 G
旅游 题目链接 考树形dp 题目描述 链接:https://ac.nowcoder.com/acm/contest/87/G 来源:牛客网 Cwbc和XHRlyb生活在s市,这天他们打算一起出去旅游。 旅行地图上有n个城市,它们之间通过n-1条道路联通。 Cwbc和XHRlyb第一天会在s市住宿,并游览与它距离不超过1的所有城市,之后的每天会选择一个城市住宿,然后游览与它距离不超过1的所有城市。 他们不想住在一个已经浏览过的城市,又想尽可能多的延长旅行时间。 XHRlyb想知道她与Cwbc最多能度过多少天的原创 2020-12-01 17:46:50 · 213 阅读 · 0 评论 -
牛客小白月赛 3
A题 按照题目模拟就行了,注意题目元音加了一个y就行 #include<iostream> #include<string> using namespace std; const int maxn=2e5+5; char yuan[6]={'a','e','i','o','u','y'}; int main() { string z; while(cin>>z) { for(int i=0;i<=z.length();i++)原创 2020-12-01 17:42:45 · 146 阅读 · 0 评论 -
牛客小白月赛1
A题 会格式化输出就行 printf("%.lf\n",y,sum2);中 y是控制的位数 :* #include<iostream> #include<cstdio> #include<math.h> #include<algorithm> using namespace std; int main() { int t,a,b,y; double sum1,sum2; double x=exp(1); cin>>t原创 2020-11-29 17:33:22 · 126 阅读 · 0 评论 -
小小小马(爆搜)
牛客小白月赛20 I 小小小马 题目链接 算法分析 dfs的题,有人用找规律也可以 算法实现 #include<iostream> #include<cstdio> #include<math.h> using namespace std; const int maxn=2e3+5; int vis[maxn][maxn]; int n,m; int dis[8][2]={{1,-2},{2,-1},{2,1},{1,2},{-1,2},{-2,1},{-2,-1},{原创 2021-01-15 22:19:50 · 184 阅读 · 0 评论 -
3的倍数(暴力搜索)
牛客小白月赛20D 3的倍数 题目链接 算法分析 n最大为15,范围比较小,所以直接来采用爆搜就行 算法实现 #include<iostream> #include<cstdio> #include<string> #include<cstring> #include<math.h> using namespace std; int ch[20][30];//ch[i][j]记录第i个字符串中j的个数,j为字符转换后的数字 int dp[30];/原创 2021-01-15 21:37:28 · 279 阅读 · 0 评论 -
斐波那契相乘(矩阵快速幂)
牛客小白月赛20A 斐波那契 题目链接 算法分析 这里要用到一个结论就是斐波那契前n项平方和就是f[n]*f[n+1] 结论证明 比较好的矩阵快速幂的说明 算法实现 #include<iostream> #include<cstdio> #include<algorithm> #include<math.h> #include<string> #include<cstring> using namespace std; typedef原创 2021-01-15 11:09:16 · 278 阅读 · 1 评论
分享