码迷,mamicode.com
首页 >  
搜索关键字:sum problem    ( 57617个结果
for循环求n个数阶乘的和
#include<stdio.h>int main() { int ret = 1; int n = 0; int i = 0; int sum = 0; printf("请输入:\n"); scanf("%d", &n);\\输入n的值 for (i = 1; i <= n; i++) { ret ...
分类:其他好文   时间:2021-02-17 15:11:38    阅读次数:0
最小生成树 : Kruskal
https://www.acwing.com/problem/content/1143/ \(裸题\) #include <bits/stdc++.h> using namespace std; #define IO ios::sync_with_stdio(false);cin.tie(0); c ...
分类:其他好文   时间:2021-02-17 14:58:39    阅读次数:0
最小生成树 : 最大边
https://www.acwing.com/problem/content/1144/ #include <bits/stdc++.h> using namespace std; #define IO ios::sync_with_stdio(false);cin.tie(0); cout.tie ...
分类:其他好文   时间:2021-02-17 14:57:50    阅读次数:0
最小生成树 : 拆点
https://www.acwing.com/problem/content/1145/ 思路 \(把已有的边加上,会形成各个连通块,等价于把每个连通块当成一个点去做Kruskal算法.\) #include <bits/stdc++.h> using namespace std; #define ...
分类:其他好文   时间:2021-02-17 14:56:41    阅读次数:0
高斯消元
高斯消元解线性方程组 时间复杂度:O(\(n^3\)) https://www.luogu.com.cn/problem/P3389 题意:给定一个线性方程组,对其求解。 #include <bits/stdc++.h> using namespace std; const char nl = '\ ...
分类:其他好文   时间:2021-02-17 14:54:53    阅读次数:0
Islands and Bridges POJ - 2288
原题链接 考察:状压dp 思路: 考虑到计算三角形,我们需要知道落脚点i和前一个落脚点j,所以需要三维数组.根据状态转移方程f[i][j][k] = f[i-{j}][k][t]+score很容易求出最大的权值.但是比较难想到怎么计算路径数目(对本蒟蒻而言).方法是再声明一个记录当前路径最大值的方案 ...
分类:其他好文   时间:2021-02-17 14:41:52    阅读次数:0
Codeforces Round #701 (Div. 2) A~C 题解
写在前边 链接:Codeforces Round #701 (Div. 2) 数学场,题目描述简单粗暴,思路很妙,代码短的不行,都是好神奇的一些题目。 A. Add and Divide 链接:A题链接 题目大意: 给定两个正整数,我们可以进行两个操作: \(a = \lfloor \frac{a} ...
分类:其他好文   时间:2021-02-17 14:39:22    阅读次数:0
【补题】Codeforces Round #700 (Div. 2) C. Searching Local Minimum
题目链接:https://codeforces.com/contest/1480/problem/C 题解: 二分法。设定查找区间为$[1,n]$。若$a_<a_{mid+1}$若$a_>a_$,则$a_$为可行解。若$a_<a_$同理可得除非$a_n$在区间$[l,mid]$严格单调增加,否则必有 ...
分类:其他好文   时间:2021-02-17 14:36:41    阅读次数:0
【Good Bye 2020 E】Apollo versus Pan
题目链接 链接 翻译 题意很简单,让你求题目描述中那个离谱的式子。 题解 大概就是这样做了一下变换 然后我们就可以固定 \(j\),问题转换成快速求解 \(\sum_{i=1}^n(x_j\ \&\ x_i)\) 和 \(\sum_{i=1}^n(xj\ |\ xi)\) 如果我们设 \(f(i,j ...
分类:其他好文   时间:2021-02-17 14:16:18    阅读次数:0
快速幂(应用:快速幂求逆元)
快速幂 (1)快速幂 求 \(a^k\ mod\ p\) 时间复杂度:O($\log$k) https://www.luogu.com.cn/problem/P1226 题意:求 \(a^k \ mod \ p\) #include <cstdio> #include <iostream> usin ...
分类:其他好文   时间:2021-02-17 14:14:44    阅读次数:0
57617条   上一页 1 ... 38 39 40 41 42 ... 5762 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!