码迷,mamicode.com
首页 >  
搜索关键字:ans    ( 3741个结果
逆元与组合数
``` LL fpow(LL x, LL power, LL mod) { x %= mod; LL ans = 1; for (; power; power >>= 1, (x *= x) %= mod) if(power & 1) (ans *= x) %= mod; return ans; }... ...
分类:其他好文   时间:2020-03-15 00:04:40    阅读次数:56
noip online 入门组
文具订购 枚举每种情况,比较找出最优的那种就可以了。 时间复杂度好像有点高,应该是擦着边过的。(我以为过不了,结果学校oj给过了) #include<bits/stdc++.h> using namespace std; int ans,ans2=-1; int a,b,c; int cmp(int ...
分类:其他好文   时间:2020-03-14 18:36:08    阅读次数:95
Leetcode(双指针专题)
Leetcode双指针刷题记录 面试题48.最长不含重复字符的子字符 题目描述 : 请从字符串中找出一个最长的不包含重复字符的子字符串,计算该最长子字符串的长度。 示例1: 提示: s.length hash; int ans = 0; for(int i = 0, j = 0; i 1) { ha ...
分类:其他好文   时间:2020-03-14 18:18:58    阅读次数:68
Codeforces 158A
#include <stdio.h> int main() { int n, k; scanf("%d %d\n", &n, &k); int temp; int ans=0, com; int i; for(i=0; i<n; ++i) { scanf("%d", &temp); if(temp> ...
分类:其他好文   时间:2020-03-14 14:56:40    阅读次数:50
1144 The Missing Number
大致题意就是给出一连串的整数(包含正负),找出未出现过的最小正整数。 1 #include<iostream> 2 #include<map> 3 using namespace std; 4 5 int main() { 6 int n,t,ans = 1; 7 map<int,bool> mp; ...
分类:其他好文   时间:2020-03-14 12:47:02    阅读次数:52
Codeforces Round #627 (Div. 3)F. Maximum White Subtree
题:https://codeforces.com/contest/1324/problem/F 题意:给节点数为n的树,每个节点有0和1,对于每个节点输出他的ans,这个ans是砍掉一些子树后0节点的数目减去1节点的数目(得留下自己) 分析:我们按照统计子树的size一样,来dfs这个树,对于父亲u ...
分类:其他好文   时间:2020-03-14 00:48:43    阅读次数:52
解题报告:luogu P6057
题目链接: "P6057 [加油武汉]七步洗手法" 为武汉助威! 大佬:真·小学奥数 我:?怎么算啊? $ps$:本来想切个绿题就滚去写文化课,结果......憋了好长时间。 总算刚了出来,开始误入枚举白边的黑洞(这个字有锅吧?!)出不来了。 主要思路: $$ans=C_{n}^3 \text{不同 ...
分类:其他好文   时间:2020-03-13 20:32:54    阅读次数:70
[树形dp][换根]Maximum White Subtree
题目链接 http://codeforces.com/contest/1324/problem/F 题意 对树中每一个点$v$,求包含$v$点的子树的最大$Cnt白 Cnt黑$ 题解 首先以点$1$作为树根,树形$dp$求出$dp[1]$,并记为答案$ans[1]$。 再换做以$1$的儿子$t$作为 ...
分类:其他好文   时间:2020-03-13 12:47:12    阅读次数:45
Codeforces 1324E Sleeping Schedule DP
题意 给你一个长度为$n$的数组$a$和3个数字$h,l和r$。$t$初始为0,每次可以使$t=(t+a_i) \% h$或者$t=(t+a_i 1)\%h$,如果这时$t\in\left[l,r\right]$就将$ans$加1。求$ans$的最大值。 解题思路 这场比赛的题感觉偏简单了。 这是一 ...
分类:其他好文   时间:2020-03-12 23:27:09    阅读次数:72
全排列
#include #include #include using namespace std; const int MAXN = 10; bool isUsed[MAXN]; vector ans; int N; void DFS(int index) { if (index >= N) { //边... ...
分类:其他好文   时间:2020-03-12 23:15:39    阅读次数:81
3741条   上一页 1 ... 18 19 20 21 22 ... 375 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!