ICode9

精准搜索请尝试: 精确搜索
  • Solution - [CEOI2017]Palindromic Partitions2021-11-16 14:02:10

    思路: 用两个指针 \(L\) 和 \(R\) ,分别指向字符串首尾。从两端同时枚举找到相同的字符串, \(s[1 - L]\) 和 \(s[R - n]\), 然后下次再从 \(L\) 和 \(R\) 出发,继续找到相同的字符串,如果最后找到字符串的长度不足 \(n\) 就将答案加 \(1\)。 例如:\(\texttt{bonobo}\) 先找到 \(s[1 -

  • Solution -「二项式定理与组合恒等式」一些练习2021-11-15 21:34:52

    \[{\Large \mathbb{No \ hay \ cosa \ mas \ feliz \ en \ el \ mundo \ que \ ver \ tu \ sonrisa \ mi \ Miffy}} \] Task 1 \(\mathcal{Prob:}\) \((3x - 2y)^{18}\) 的展开式中, \(x^5y^{13}\) 的系数是什么?\(x^8y^9\) 的系数是什么? \(\mathcal{Sol:}\) 由二项

  • noip2021 训练4 做题记录2021-11-13 20:31:56

    P3523 [POI2011]DYN-Dynamite Description Luogu传送门 Solution 经典树上 \(dp\)。 首先二分 \(mid\) 表示最远的距离。 设 \(f_{x}\) 表示距 \(x\) 最远的未被覆盖的关键点到 \(x\) 的距离,\(g_x\) 表示 \(x\) 到该子树中的选定点的最小距离。 初值显然:\(f_x = -inf\),\(g_x = i

  • 21天好习惯第一期—192021-11-10 23:00:20

    力扣日常切题 1.统计字符串中的元音子字符串 题解:三重循环暴力  AC代码如下: class Solution { public: int countVowelSubstrings(string word) { int sum=0; for(int i=0;i<word.size();i++){ for(int j=i+4;j<word.size();j++) { i

  • 两数之和~2021-11-07 23:34:29

    题目 方法一:暴力枚举 思路和算法 暴力枚举数组中每一个数x,寻找数组中是否存在target-x c++: class Solution { public: vector<int> twoSum(vector<int>& nums, int target) { for(int i= 0; i<nums.size(); i++){ for(int j=i+1; j<nums.si

  • 485. 最大连续 1 的个数2021-11-07 16:32:39

    class Solution { public: int findMaxConsecutiveOnes(vector<int>& nums) { int count=0; int max=count; for(int i=0;i<nums.size();i++){ if(nums[i]==1) count++; if(count>max) max = count;

  • noip2021 训练 3 做题记录2021-11-07 12:02:52

    简介 一大堆毒瘤构造题中夹杂着几道其他题目…… 题目 CF1348D Phoenix and Science Description Luogu传送门 Solution 考虑最快情况,即 \(1 \rightarrow 2 \rightarrow 4 \rightarrow 8 ····\) 但是我们发现如果前期分裂太多,后面可能会出现不可控的情况,即超出题目要求达到

  • Master Thesis的自我改进2021-11-06 09:00:16

    thesis对于性能要求不高,需要的是一个有insight的完整的工作 Intro太短,首先介绍task,然后大概这个task大家都怎么做的(fully supervised),然后说fully super有什么难点,针对这些难点,有些什么solution,我们的solution是什么,取得了怎么样的结果 至少2-3页才合理 literature review差不多就

  • 每日力扣——69. Sqrt(x)2021-11-05 20:58:56

    class Solution { public: int mySqrt(int x) { long i=0; while(i*i<=x) { i++; } return (int)i-1; } };    

  • 力扣:50. Pow(x, n)2021-11-04 10:31:28

      1、用递归形式的二分快速幂去求解  class Solution { public: double myPow(double x, int n) { if(n<0) { long long m=-(long long)n; return 1/qpow(x,m); } else return qpow(x,n); } doub

  • codewars练习2021-10-31 14:33:34

    如果我们列出所有小于10的自然数中,3或5的倍数,我们可以得到3 5 6 9。这几个数的和为23。 #给一个数,返回所有小于它的自然数,3和5的倍数之和。如果其中有负数,则返回0。 #样例:solution(4), 3 ,solution(6), 8。 1 def solution(number): 2 sum = 0 3 if number<0: 4

  • leetcode:Array reverse2021-10-30 19:35:27

    nums = "----->-->"; k =3 result = "-->----->"; reverse "----->-->" we can get "<--<-----" reverse "<--" we can get "--><-----" reverse "<-----" we c

  • LeetCode刷题_70_爬楼梯2021-10-30 12:34:14

    70 爬楼梯 class Solution(object): def climbStairs(self, n): """ :type n: int :rtype: int """ dp = [] for i in range(n): if i == 0: dp.append(1)

  • Solution Set - 神奇 NOIP 模拟赛2021-10-29 23:03:13

    \[\mathfrak{\text{Defining }\LaTeX\text{ macros...}}\newcommand{\vct}[1]{\boldsymbol{#1}}\newcommand{\stir}[2]{\genfrac{\{}{\}}{0pt}{}{#1}{#2}}\newcommand{\opn}[1]{\operatorname{#1}}\newcommand{\lcm}[0]{\opn{lcm}}\newcommand{\sg}[0]{

  • OBDSTAR X300 DP Plus “DiagProgram has stopped” Solution2021-10-28 22:03:19

    Question:Do SAS Recovery, OBDSTAR X300 DP Plus has this error prompt “Unfortunately, DiagProgram has stopped”. Programming, Immo, odometer…all the same, and not working. Then he shows us Version in ABOUT (“VCI” button below) as eobdtool technical supp

  • TFS中的Solution Folder 和 物理磁盘 Folder的区别和含义2021-10-28 10:04:45

    1。解决方案文件夹【Solution Folder】 这类文件夹只是逻辑上的分组,实际在磁盘不会创建; 2。新建文件夹【New Folder】    如果通过这样的方式创建文件夹,是在磁盘上【物理】创建的,也就是你可以在你的磁盘里找到你创建的这个文件夹。 并且,这个文件夹自动就是受源代码控制的。 2.1

  • leetcode(3):再多个字符串里取出公共的字符串2021-10-27 14:32:03

    class Solution: def longestCommonPrefix(self, s) -> str: ''' 判断s是不是空,是空的话直接返回,不是空进入逻辑判断 :param s: :return: ''' if not s: return "" # 取list里的第一个字符,用这个

  • 2021 1016 每日一题 下一个更大元素Ⅰ2021-10-26 23:03:21

    跟我妈打电话的时候 随便写了写 一次就过啦 今日份开心  但是我的内存占用很大很大 基本上就是暴力求解 好好学一下栈 和 各种排序查找算法       class Solution { public int[] nextGreaterElement(int[] nums1, int[] nums2) { int length1=nums1.length; int

  • leetcode 75 颜色分类2021-10-26 18:04:42

       代码: class Solution { public: void sortColors(vector<int>& nums) { int Left = 0,right = nums.size()-1; int ptr= 0; for(int i = 0;i<nums.size();i++) { if(nums[i] == 0) {

  • [leetcode] 69 Sqrt(x)2021-10-25 21:02:30

    题目描述: 给定一个非负整数,求它的开方,向下取整 题解: 方法一: class Solution { public int mySqrt(int x) { int i=1; for(i=1;i>0;i++){ if(i*i-x>0){ break; } } return i-1; } } 方法二:二分查找 class Solution { p

  • 【添青的LeetCode刷题笔记】1.两数之和2021-10-23 17:02:39

    (一)题目 给定一个整数数组 nums 和一个整数目标值 target,请你在该数组中找出和为目标值的那两个整数,并返回它们的数组下标。 你可以假设每种输入只会对应一个答案。但是,数组中同一个元素在答案里不能重复出现。 你可以按任意顺序返回答案。  示例1: 输入:nums = [2,7,11,15],  t

  • Solution Of 不会输的游戏2021-10-21 22:34:08

    注:\(\oplus\) 为异或符号 ,\(\land\) 表示逻辑与,\(\lor\) 表示逻辑或 这是一道魔改题,为luogu P7841 100%不公平的游戏 的弱化版 请先了解 \(SG\) 函数的相关内容,否则本文可能不太友好 对 \(SG\) 函数不了解的可以参考博弈论 显然每棵树是一个 \(SG\) 游戏,而整个森林为这些 \(SG\)

  • Solution Of My Contest:playing with 毛玉2021-10-21 22:32:06

    problem A:等差之和 这是一道魔改题,启发自luogu P4231 三步必杀 易发现一个初始项\(a_1\)、公差\(b_1\)的等差数列与一个初始项\(a_2\)、公差\(b_2\)的等差数列相加得到一个初始项\((a_1+a_2)\)、公差\((b_1+b_2)\)的等差数列 考虑对固定区域的序列操作,发现可以简单维护初始项的标

  • Solution -「CF 1586F」Defender of Childhood Dreams2021-10-20 21:32:19

    \(\mathcal{Description}\)   Link.   定义有向图 \(G=(V,E)\),\(|V|=n\),\(\lang u,v\rang \in E \Leftrightarrow u<v\)。求一个对 \(E\) 的染色 \(f\),使得 \(\not\exist \lang v_1,v_2,\cdots,v_{k+1} \rang, |\{f(v_i,v_{i+1})\mid i\in[1,k]\}|=1\),同时最

  • Solution -「OurOJ 46544」漏斗计算2021-10-20 11:35:26

    \(\mathcal{Description}\)   Link.   定义一个运算结点 \(u\) 有两个属性:当前容量 \(x_u\)、最大容量 \(V_u\)。提供以下单元操作: I 读入一个整数 \(x\),令新结点 \(u=(x,x)\)。 F u 装满 \(u\) 结点,即令 \(x_u=V_u\)。 E u 清空 \(u\) 结点,即令 \(x_u=0\)。 C s 令新

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

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

ICode9版权所有