码迷,mamicode.com
首页 >  
搜索关键字:nyoj 215 sum    ( 23169个结果
kafka初步使用
生产者 KafkaExtendProducer.send("topic","key","value"); 消费者 @Slf4j @RequiredArgsConstructor @Component public class ConsumerThread implements Runnable { ...
分类:其他好文   时间:2021-01-15 11:46:10    阅读次数:0
LeetCode938. 二叉搜索树的范围和
题目 1 class Solution { 2 public: 3 int sum = 0; 4 int rangeSumBST(TreeNode* root, int low, int high) { 5 dfs(root,low,high); 6 return sum; 7 } 8 void d ...
分类:其他好文   时间:2021-01-14 11:04:51    阅读次数:0
[Leetcode]1. Two Sum
题目描述 Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target. You may assume that eac ...
分类:其他好文   时间:2021-01-13 11:07:09    阅读次数:0
P2486 [SDOI2011]染色
###链接 调了好久。。。 我平常写平衡树时 \(push\) \(tag\) 的操作都习惯把 \(rev\) 数组清零,但在 \(LCT\) 中不行,因为 \(rev\) 储存了节点间的父子关系,直接清零会改变树的结构。 \(\frak{code}\) #include<bits/stdc++.h ...
分类:其他好文   时间:2021-01-12 11:26:50    阅读次数:0
每日一题——228. 汇总区间
228. 汇总区间 分类: 数组 简单题,但是边界条件挺细节,特别是c++,还要额外注意int的边界,不然 nums[i] == nums[i-1] + 1会overflow class Solution { public: vector<string> summaryRanges(vector<i ...
分类:其他好文   时间:2021-01-12 11:07:54    阅读次数:0
CF1043E Solution
题目链接 题解 可以发现枚举两个在一组里的数会TLE,加之只有两个参数限制与数据范围,容易想到排序算法。 计算第$i$个人的分数和需要知道他在每一组里是$x$还是$y$,因此排序需要满足$a_i$前的数与$a_i$组合时为$x$更优,而$a_i$后的数与$a_i$组合时为$y$更优(反之亦可),也就 ...
分类:其他好文   时间:2021-01-12 11:02:49    阅读次数:0
CF1041E Solution
题目链接 题解 答案一定可以为一条链,因为对于答案树中的每个节点将其子节点从大到小排序放入链尾后依旧成立。 探讨限制条件:(1)$b$只能为$n$,因为$n$一定是它所在连通分量中的最大值。(2)设$cnt_i$表示$i$作为$a$出现的次数,则$\sum\limits_^icnt_j<i$,因为每 ...
分类:其他好文   时间:2021-01-12 11:02:30    阅读次数:0
P3252 [JLOI2012]树
Aimee 记忆化搜索非常好写, 尤其是从一个朴素的搜索开始改造。 sum是要记录的,但是没必要存在状态里 直接统计一下当前节点是第几步之后的方案数 虽然说时间复杂度没有朴素的优美 但是不会MLE啊 #include<iostream> #include<cstdio> #include<cstri ...
分类:其他好文   时间:2021-01-12 11:00:15    阅读次数:0
c语言中的对象式宏
1、 #include <stdio.h> #define NUMBER 5 int main(void) { int i; int sum = 0; int a[NUMBER]; puts("please input the scores."); for (i = 0; i < NUMBER; i ...
分类:编程语言   时间:2021-01-12 10:33:53    阅读次数:0
java基础复习三
方法 //main方法 public static void main(String[] args) { int sum=max(1,2); int sum2=add(1,2); System.out.println(sum); System.out.println(sum2); } //加法 pu ...
分类:编程语言   时间:2021-01-11 10:44:24    阅读次数:0
23169条   上一页 1 ... 28 29 30 31 32 ... 2317 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!