ICode9

精准搜索请尝试: 精确搜索
  • 15. 三数之和2022-08-02 19:01:55

    15. 三数之和 给你一个包含 n 个整数的数组 nums,判断 nums 中是否存在三个元素 a,b,c ,使得 a + b + c = 0 ?请你找出所有和为 0 且不重复的三元组。 注意:答案中不可以包含重复的三元组。   示例 1: 输入:nums = [-1,0,1,2,-1,-4] 输出:[[-1,-1,2],[-1,0,1]] 示例 2: 输入:nums =

  • Codeforces Round #811 (Div. 3)2022-08-02 02:00:39

    咕咕咕。 D. Color with Occurrences 题意 给定文本串\(t\),和\(n\)个模式串\(s_i\)。 初始时\(t\)的每个字符都是黑色的,如果\(t\)的某个子串和\(s_i\)相等,则可以通过一次染色将这个子串中的字符都染成红色。 一个模式串可以用多次,\(t\)中的一个字符可以被染色多次,红色的字符再次

  • 7.292022-08-01 02:00:30

    CF954F 题意: 有一个\(3*m\)的格子,起点是\((2,1)\),终点是\((2,m)\),每一步可以向正右,右上,右下走,有多少种方案从起点走到终点? 额外有\(k\)个限制,每个形如在\([l_k,r_k]\)范围内,第\(a_k\)行不可进入。 \(k\leq 10^4,m\leq 10^{18}\) \(2\leq l_k\leq r_k\leq m,1\leq a_k\leq 3\) 题解

  • 统计算法find_if自定义数据类型2022-07-31 13:35:07

    #include <iostream> #include <vector> #include <algorithm> using namespace std; class Person { public: Person(string name, int age): name(name), age(age) {} bool operator==(const Person &p) { return p.age ==

  • 查找算法find_if自定义数据类型2022-07-31 13:03:21

    #include <iostream> #include <vector> #include <algorithm> using namespace std; class Person { public: Person(string name, int age): name(name), age(age) {} string name; int age; }; class Print { public: void oper

  • 二元谓词2022-07-31 11:04:05

    #include <iostream> #include <vector> #include <algorithm> using namespace std; class Print { public: void operator()(int i) { cout << i << endl; } }; class Compare { public: bool operator()(int a, int b)

  • OSG创建柱元2022-07-30 17:32:55

    名词翻译: 法向量:normal vector 法线:normal 代码: //分支判断start if (_columnType == Circle1) //圆形规则 { for (size_t i = 0; i < 120; i++) { osg::Vec3 Point = _temp + L * osg::Matrix::rotate(osg::inDegrees(i * 3.0), normal); //osg::Vec3f L = osg::Vec3f(1, 0

  • Leetcode 119. 杨辉三角 II2022-07-30 11:34:11

    给定一个非负索引 rowIndex,返回「杨辉三角」的第 rowIndex 行。 在「杨辉三角」中,每个数是它左上方和右上方的数的和。 示例 1: 输入: rowIndex = 3 输出: [1,3,3,1] 示例 2: 输入: rowIndex = 0 输出: [1] 示例 3: 输入: rowIndex = 1 输出: [1,1] 提示: 0 <= rowIndex <

  • AcWing 794. 高精度除法2022-07-29 20:33:14

    算法思路 模拟除法竖式。 流程 从最高位开始处理,上一次的余数 \(\times 10\) 再加上当前位上的数字(被除数,我们令它为 \(A\)); 往答案数组中压入 \(\lfloor \frac{A}{B} \rfloor\)(这里 \(B\) 表示除数),然后将余数更新为 \(A~mod~B\); 重复以上操作。 代码 #include <iostream> #inclu

  • AcWing 791. 高精度加法2022-07-28 15:01:38

    观察题目 第一眼看题:这不就是大淼题 \(\text {A + B}\) 吗? 再一看,看到数据范围 \(1 \leq 整数长度 \leq 100000\),很显然,\(C++\) 中自带的数据类型肯定不行。 怎么办? 算法思路 观察到题目给出的整数长度数组存的下,因此我们可以先读入两个字符串,然后转成数组。 还记得小学一年级老师

  • AcWing 792. 高精度减法2022-07-28 15:00:42

    算法思路 与高精度加法大致相同,同样运用了“列竖式”的思想。 当然,加法中的“进位操作”要改成减法中的“退位操作”。 具体过程如下: 从最低位开始,用被减数的这一位减去减数的这一位; 判断是否构够减,若不够减(即减数的这一位大于被减数的这一位),则向高一位借一(被减数高一位减一,当前

  • 算法学习之路 高精度算法2022-07-28 12:00:07

     //高精度加法模板  #include<bits/stdc++.h> using namespace std; vector<int>add(vector<int>  &A,vector<int>&B) {     vector<int>C;     int  t = 0;//进位;     for(int i = 0;i < A.size() || i < B.size() ;i++ )     {      

  • LeetCode 103 Binary Tree Zigzag Level Order Traversal 双端队列 Deque2022-07-28 04:33:41

    Given the root of a binary tree, return the zigzag level order traversal of its nodes' values. (i.e., from left to right, then right to left for the next level and alternate between). Solution 由于是 \(zigzag\) 的形式,刚开始的思路是用 \(stack\) 来维护反序,但是

  • list容器反转排序2022-07-28 00:02:45

    #include <iostream> #include <vector> #include <list> #include <algorithm> using namespace std; template<class T> void myPrint(const T &data) { typename T::const_iterator it; for(it = data.begin(); it != data.end(

  • Back trader 支持的指标查询方式2022-07-27 23:05:58

    在使用BACKTRADER的时候需要知道包本身支持多少个指标 直接查询包安装目录下面有多少个程序就可以,一个程序对应一个指标  

  • 数学-求组合数 IV-大整数模拟2022-07-27 20:31:49

    C++ AcWing 888. 求组合数 IV /* * 题目描述: * AcWing 888. 求组合数 IV * 输入 a, b,求 C(a, b) 的值。 * 注意结果可能很大,需要使用高精度计算。 * * 输入格式 * 共一行,包含两个整数 a 和 b。 * * 输出格式 * 共一行

  • 剑指 Offer 59 - II. 队列的最大值2022-07-27 19:02:19

    剑指 Offer 59 - II. 队列的最大值 请定义一个队列并实现函数 max_value 得到队列里的最大值,要求函数max_value、push_back 和 pop_front 的均摊时间复杂度都是O(1)。 若队列为空,pop_front 和 max_value 需要返回 -1 示例 1: 输入: ["MaxQueue","push_back","push_back","max_

  • vector容器互换(swap)2022-07-27 18:03:33

    #include <iostream> #include <vector> #include <algorithm> using namespace std; class Print { public: void operator()(int i) { cout << i << endl; } }; int main() { vector<int> v1; v1.push_back(1);

  • AC自动机2022-07-27 00:05:33

    oj传送门 本质上是在trie树上套kmp的next数组(fail数组),用bfs按逐层遍历可以保证不重复和遗漏。 \\题目中要求出模式串重复次数,由于模式串自身较短,可以暴力失配找后缀匹配的模式串 #include<bits/stdc++.h> using namespace std; const int maxn=150*70+100; const int maxm=1e6+1

  • C++新特性 迭代器及类型推导2022-07-25 08:31:16

    1.1 迭代器   stl 中存在一些常见的已经封装好(开箱即用)数据结构相关的模板类,例如 vector(动态数组)、list(链表)、stack(栈)、queue(队列)、map(hash表/红黑树)等,这些类通常都有一些最基本的操作,例如:增加、删除、修改、遍历等等。   C++ 为了方便统一,采用了设计模式中的迭代

  • Addition Chains2022-07-24 00:02:27

    6136: Addition Chains 时间限制(普通/Java):1000MS/3000MS     内存限制:65536KByte   描述 An addition chain for n is an integer sequence <a0, a1,a2,...,am> with the following four properties: a0 = 1 am = n a0 < a1 < a2 < ... < am-1 < am For each k

  • day272022-07-23 12:01:18

    1.剑指 Offer 59 - I. 滑动窗口的最大值  单调队列 1 class Solution { 2 public: 3 vector<int> maxSlidingWindow(vector<int>& nums, int k) { 4 vector<int> res; 5 deque<int> q; 6 int n = nums.size(); 7 for(int i

  • LOJ #3343. 「NOI2020」超现实树2022-07-21 17:04:38

    提交记录 题目叙述 二叉树,称一棵树可以长成另外一颗树,当且仅当可以通过替换这棵树的叶子节点为随便其他的树,变成另一棵树。给定一个树的集合,判断是否可以只有有限棵树凑不出。 题解 考虑暴力怎么写,判断 \(i\) 的子树的所有情况是不是几乎完备的。然后只要判断左儿子和右儿子是不是

  • vector2022-07-19 23:00:57

    1.定义和初始化      2.基本操作   1.索引访问          2.计算大小          3.front back           4.clear 清空          5.begin,end 返回迭代器(指针)   6.empty  判断是否为空           7.交换俩数组的内容      3.动态

  • oracle-导入导出2022-07-17 01:33:46

    oracle自带两个工具(exe文件),exp和imp 完成 数据库的导出和导入。 1导出exp: a.表方式:导出指定的表 exp scott/tiger@127.0.0.1 file=d:/back/bk.dmp log=d:/back/log.log tables=emp,dept 如果报ORA-12504: TNS: 监听程序在 CONNECT_DATA 中未获得 SERVICE_NAME,那就需要指明数据库

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有