Edison's Blog
  • 首页
  • 归档
  • 说说
  • 友链
  • 关于
  • 首页
  • 归档
  • 说说
  • 友链
  • 关于
当前位置: 首页 › 分类:做题
  • edisoncgh - 2月前

    LeetCode307-区域和检索

    数据结构 树状数组

    传送门 树状数组板子题。借这道题整理一下树状数组的模板 class NumArray { private: vector<int> tree; vector<int> arr; int n; int lowbit(int x) { return x & -x; } // 求前缀和 // ……

    来自分类:做题
     207  0 0 阅读
  • 置顶
    edisoncgh - 2月前

    edisoncgh的cpp小抄

    C/C++

    开篇文章记录一下C++在算法竞赛中好用的一些小技巧。 // string转int int num = atoi(str.c_str()); // 数组最大元素 int maxElement = *max_element(arr.begin(), arr.end()); // 数组最大元素下标 int *p = max_……

    来自分类:做题 / 语言学习
     138  0 7 阅读
  • edisoncgh - 2月前

    LeetCode2028-找出缺失的观测数据

    数学 模拟

    传送门 这是我做过最简单的 。 先考虑非法的情况。显然,如果n个缺失的骰子全置为6都不能使骰子值之和满足题设条件,这组数据就找不到合法答案。同理可得,n个缺失骰子全为1都不满足题设也是一种镜像情况。这样我们就得到了这道题的边界条件。 接着考虑合法解法。我们可以根据rolls数组之和与mean值计算出n个缺失数据的平均值……

    来自分类:做题
     106  0 2 阅读
  • edisoncgh - 2月前

    LeetCode682-棒球比赛

    栈 模拟

    传送门 水题,一眼栈 class Solution { public: int calPoints(vector<string>& ops) { stack<int> stk; for (auto el : ops) { if (el[0] == ‘C’) { if (!stk.empt……

    来自分类:做题
     73  0 1 阅读
  • edisoncgh - 2月前

    LeetCode172-阶乘后的零

    找规律 数学

    传送门 对于任意一个数,×10就能使它尾部多一个0。分析一下样例,n=5时n!=12345=120,其实就是134(25) = 12 * 10。即,产生一个末尾0的原因是累乘的数里能凑一个“10”出来。那么我们只需要统计相乘的n个数有能凑几个10就行。更进一步简化, 由于10=2*5,且固定的范围内,因子5总是比因子2……

    来自分类:做题
     69  0 0 阅读
  • edisoncgh - 2月前

    LeetCode661-图片平滑器

    前缀和

    传送门 二维前缀和,定义f[i][j]为从矩阵左上角(0,0)到当前位置(i-1,j-1)的元素之和,那么任意一个3×3小矩阵内的9个元素之和就是tot=f[i+2][j+2] – f[i+2][j-1] – f[i-1][j+2] + f[i-1][j-1] 提一下这个状态转移方程需……

    来自分类:做题
     82  0 1 阅读
  • edisoncgh - 1年前

    LeetCode每日一题:解码异或后的排列

    数学 每日一题

    传送门 思路 往位运算想就是想复杂了。根据题目意思,perm[i]的范围是[1,n],且每个perm[i]不重复。这就意味着perm[0]^perm[1]^…^perm[n]是已知的。 假设: perm=[a,b,c,d,e],encoded=[f,g,h,i]; 显然有: f = a^b; g = b^c……

    来自分类:做题
     1.15k  0 3 阅读
  • edisoncgh - 1年前

    markdown测试

    一级标题 行内代码 import os def fun(): return “python” class Solution { public: int minDays(vector<int>& bloomDay, int m, int k) { const int n = bloomDay.size……

    来自分类:做题
     439  0 1 阅读
  • edisoncgh - 1年前

    LeetCode每日一题:制作 m 束花所需的最少天数

    二分查找 每日一题

    传送门 思路 题目是很标准的“找到最大或最小”,也就是说假设正解为ans,(-∞,ans)范围内都无法满足题设条件,而[ans,+∞)都能满足要求,且ans是满足要求的值中最小的那个,这样ans就是一个“合法与非法”的分割点。对于形如这样的题设,就可以对答案序列进行二分来在一个较优的复杂度内枚举到答案。 就本体内容具体……

    来自分类:做题
     415  0 3 阅读
  • edisoncgh - 1年前

    LeetCode每日一题:完成所有工作的最短时间

    DFS 每日一题

    传送门 思路 题目读完,很容易想到DFS的思路,很快就可以撸一个标准的dfs解法: 记录当前最大值maxn,每次遍历到最后一个job就更新maxn到ans中。通过函数体中第一个if来维护“最小的最大值”。思路很清晰,可惜会超时。 根据题设,k和n的范围都是[1,12],这个dfs的复杂度是O(kn)的复杂度,也就是12……

    来自分类:做题
     426  0 3 阅读
(。・`ω´・)点我加载更多
  • edisoncgh
  • with sifour for:

  • 文章

    • 「LeetCode每日一题:保证图可完全遍历」

       965 0 1年前

    • 「LeetCode周赛#220」

       497 0 1年前

    • 「C++类与对象」

       664 0 2年前

    • 「蓝桥杯B组模拟赛第二场」

       1.42k 0 2年前

    • 「牛客contest5667-B」

       793 0 2年前

  • 最近访客

  • 评论

    • 「edisoncgh」于「12月前」在「互换友链」中说:
      爱心
    • 「sifour」于「1年前」在「互换友链」中说:
      ( ,,´・ω・)ノ"(´っω・`。)
    • 「r57 shell」于「1年前」在「poj2524:Ubiquitous Religions」中说:
      Hello there! This is my 1st comment here so I just wanted to give a quick shout out and say I really enjoy reading through your articles. Can you suggest any other blogs/websites/forums that cover the same subjects? Thank you!
    • 「erotik」于「1年前」在「C++Trie树(字典树)」中说:
      I wish to point out my passion for your generosity giving support to people who require help with your situation. Your special commitment to passing the solution around appears to be pretty significant and have usually made people like me to get to their aims. The important facts signifies a whole lot a person like me and a whole lot more to my fellow workers. Many thanks; from everyone of us. Frannie Prentiss Langille
    • 「escort bayan」于「1年前」在「C++Trie树(字典树)」中说:
      Awesome post. I am a regular visitor of your blog and appreciate you taking the time to maintain the excellent site. I will be a frequent visitor for a long time. Manon Cornie Elwina
  • 标签云

    网赛 每日一题 刷题 补题 周赛 字符串 贪心 动态规划 数据结构 数论 模拟 栈 数学 hash 图 专题训练 并查集 Java 双周赛 算法学习 蓝桥杯 C/C++ 二分查找 单调栈 枚举 DFS 堆 codeforce python Java SSM WordPress 位运算 二叉树 滑动窗口 找规律 BFS MySQL 前缀和 高精度 最小生成树 字典树 树状数组 git nlp 回溯 树 数组 逆元 集合 计算几何 矩阵 递推 AVL树 C++ php 字典 编译原理

版权所有 © 2021 Edison's Blog | 蜀ICP备19020246号-1
Theme Memory By Shawn | All Rights Reserved
-666-本博客已在世苟活了
萌ICP备 20200126号