码迷,mamicode.com
首页 >  
搜索关键字:ans    ( 3741个结果
475. 供暖器
class Solution(object): def findRadius(self, houses, heaters): """ :type houses: List[int] :type heaters: List[int] :rtype: int """ ans = [] heaters.s ...
分类:其他好文   时间:2020-06-08 14:25:21    阅读次数:49
求最大值
#include using namespace std; const int INF=0x3f3f3f3f; int a[1000],b[1000],ans=0,dp[101][200000+10],n,off=100000;//直接偏移,省事 //有两个量互相制约,两个量都单独的条件,这种类型,... ...
分类:其他好文   时间:2020-06-06 22:03:09    阅读次数:77
加分二叉树
#include using namespace std; //加分二叉树 int n,dp[40][40]={0},a[40],ans=0,root[40][40]; void f(int i,int j){ if(i>j) return; cout>n; for(int i=1;i>a[i]; ... ...
分类:其他好文   时间:2020-06-06 21:27:21    阅读次数:60
能量项链
#include using namespace std; //算法提高,能量项链,就是可以转圈的矩阵连乘问题 //把1->n扩展为1->n->n+1->2*n,然后对其进行dp,这样就循环起来了 int dp[2000][2000],n,a[1000],ans=0;//用i表示左维度,i+1表示右... ...
分类:其他好文   时间:2020-06-06 21:24:30    阅读次数:48
Codeforces Round #498 (Div. 3) E. Military Problem (DFS)
题意:建一颗以$1$为根结点的树,询问$q$次,每次询问一个结点,问该结点的第$k$个子结点,如果不存在则输出$-1$. 题解:该题数据范围较大,需要采用dfs预处理的方法,我们从结点$1$开始向下找,$ans$数组记录的是,第$x$次查找时的结点,$path$表示某个结点所需的查找次数,$siz$ ...
分类:其他好文   时间:2020-06-04 19:43:10    阅读次数:53
luogu P6113 【模板】一般图最大匹配 带花树
#include<bits/stdc++.h> #pragma GCC optimize(3) using namespace std; const int N=1009,M=100009; int n,m,ans,ord,q[M],pre[N]; int ql,qr,dfn[N],lk[N]; i ...
分类:其他好文   时间:2020-06-03 00:40:13    阅读次数:54
luogu P2979 [USACO10JAN]Cheese Towers S 变形dp背包
#include<bits/stdc++.h> const int N=100+10; const int T=5000; using namespace std; int n,t,k,ans; int v[N],h[N],f[T]; int now; //如果不考虑大的,x=t-h[i] //考虑 ...
分类:其他好文   时间:2020-06-01 21:08:26    阅读次数:98
NTT封装板子
ll result_len,result[maxn],level=0,trans[maxn]; ll quick(ll a,ll b,ll m) { ll ans=1; while(b>0) { if(b&1) ans=ans*a%m; a=a*a%m; b>>=1; } return ans; } ...
分类:其他好文   时间:2020-06-01 14:04:02    阅读次数:63
LeetCode 412. Fizz Buzz
使用散链表的字符串连接法。 class Solution { public: vector<string> fizzBuzz(int n) { vector<string> ans; //Hash map to store all fizzbuzz mappings. map<int, string ...
分类:其他好文   时间:2020-05-30 12:43:38    阅读次数:59
Luogu P5850 calc加强版
Link \[ ans_n=[x^n]\prod\limits_{i=1}^k(1+ix)=[x^n]\exp(\sum\limits_{i=1}^k\ln(1+ix))=[x^n]\exp(\sum\limits_{j\ge1}\frac{(-1)^{j+1}\sum\limits_{i=1}^k ...
分类:其他好文   时间:2020-05-28 21:42:16    阅读次数:70
3741条   上一页 1 ... 9 10 11 12 13 ... 375 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!