ICode9

精准搜索请尝试: 精确搜索
  • 模板集合2022-08-28 22:32:23

    建议用标题旁边打开的目录,更清晰明了! 太多了,编辑的时候要找好久,数据结构和图论都搬出去了,下面有链接。离数学搬家也不远了。 其他 读入、输出优化(必加!!!) 快读 模板 inline int read(){ int sum=0,f=1;char a=getchar(); while(a<'0' || a>'9'){if(a=='-') f=-1;a=getchar();} w

  • 真正的骗子(种类并查集)2022-08-28 21:01:43

    题目链接   思路:     分成两类:1.村民说真话,2.村民说假话。当村民说是好人的时候,有两种情况,他们都是好人和都是坏人。所以将\(a\ + \ (x + y) ,\ b\ +\ (x + y)\)和\(a, b\)合并为一个集合。同理将\(a,b+(x + y)\)和\(a + (x + y), b\)合并为一个集合。     这个合并的

  • 29. 两数相除2022-08-28 15:03:17

      难度中等966收藏分享切换为英文接收动态反馈 给定两个整数,被除数 dividend 和除数 divisor。将两数相除,要求不使用乘法、除法和 mod 运算符。 返回被除数 dividend 除以除数 divisor 得到的商。 整数除法的结果应当截去(truncate)其小数部分,例如:truncate(8.345) = 8

  • 树哈希 学习笔记2022-08-28 10:30:10

    1.做法(from peehs_moorhsum) 设 \(h(u)\) 表示一个点的哈希值,\(f\) 为一随机函数。 \(h(u)=1+\sum\limits_{v\in son_{u}}f(h(v))\) 首先 \(f\) 的选择大概率是随机的,只要尽量不选多项式即可。(微调一下)。 ull d(ull x){ return x*x*x*19260817+20220827; } ull f(ull x){

  • 跨域问题的解决方案2022-08-28 06:30:09

    1.jsonp的方法         //ajax封装的jsonp,jsonp本质上是通过script标签的src属性解决的跨域问题,只能解决get类型的请求         $.ajax({             url: 'http://127.0.0.1:3000/fruits',             dataType: 'jsonp'         }).done(res => {

  • 剑指 Offer II 112. 最长递增路径-----记忆化搜索2022-08-27 11:30:09

    题目表述 给定一个 m x n 整数矩阵 matrix ,找出其中 最长递增路径 的长度。 对于每个单元格,你可以往上,下,左,右四个方向移动。 不能 在 对角线 方向上移动或移动到 边界外(即不允许环绕)。 输入:matrix = [[9,9,4],[6,6,8],[2,1,1]] 输出:4 解释:最长递增路径为 [1, 2, 6, 9]。 记忆化

  • $.post 和 $.get 设置同步和异步请求2022-08-26 12:30:40

    $.post 和 $.get 设置同步和异步请求 由于$.post() 和 $.get() 默认是 异步请求,如果需要同步请求,则可以进行如下使用:在$.post()前把ajax设置为同步:$.ajaxSettings.async = false;在$.post()后把ajax改回为异步:$.ajaxSettings.async = true; $.ajaxSettings.async = false;

  • 870. 优势洗牌2022-08-26 01:00:09

      labuladong 题解思路 难度中等196收藏分享切换为英文接收动态反馈 给定两个大小相等的数组 nums1 和 nums2,nums1 相对于 nums 的优势可以用满足 nums1[i] > nums2[i] 的索引 i 的数目来描述。 返回 nums1 的任意排列,使其相对于 nums2 的优势最大化。   示

  • 序列查询新解2022-08-25 20:35:52

    https://www.acwing.com/problem/content/4284/ #include <iostream> #include <cstring> #include <algorithm> using namespace std; typedef long long LL; const int N = 100010; int n, m; int a[N]; int R; LL get(int l, int r) // 求g[l] + g[

  • 数论做题记录2022-08-25 20:01:48

    P3811 【模板】乘法逆元 数据范围是只能 \(\mathcal{O}(n)\) 过的。 考虑递推逆元。 设 \(t = p / i, k = p % i\)。 \(t * i + k \equiv 0(\bmod p)\). \(k \equiv - t * i (\bmod p)\) \(inv[i] \equiv - t * inv[k] (\bmod p)\) \(inv[i] \equiv - p / i * inv[p % i] (\bmod p

  • 天长地久2022-08-25 13:00:09

    https://www.acwing.com/problem/content/description/4275/ 优质题解:https://www.acwing.com/solution/content/89003/ #include <iostream> #include <vector> #include <algorithm> using namespace std; typedef pair<int,int> PII; int m,k,cnt = 0

  • vue中element-ui table滚动加载2022-08-25 12:01:25

    //1.在main.js里注册  Vue.directive('loadmore', {  bind(el, binding) {  const selectWrap = el.querySelector('.el-table__body-wrapper')  selectWrap.addEventListener('scroll', function() {  let sign = 0  const scrollDistance = this.

  • 8.24总结2022-08-25 09:03:53

    寿司 考场上我对于这道题第一眼感觉是DP(反正不会是数据结构),但n的数据范围太大了,我没有想到O(n)的DP。于是考虑是否是贪心,但考场上我推出的贪心式子有问题。我是通过枚举每一个连续位置,找出到达这个位置的步数,求步数的最小值,但我的贪心方法在找到达连续位置的步数时不是最优,所以错

  • 2022牛客暑假第五场加塞2022-08-25 09:01:11

    M-Maimai DX 2077_"蔚来杯"2022牛客暑期多校训练营(加赛) (nowcoder.com) 阅读理解和膜你题。 double pts[5][5]={ {1,1,0.8,0.5,0}, {2,2,1.6,1.0,0}, {3,3,2.4,1.5,0}, {5,5,2.5,2,0}, {1,0.5,0.4,0.3,0} }; int num[4][5]; int sum[4]; double A,B,A0,B0; int main(){ for

  • LCA C 求和 求子树权值和 树上节点单点修改 dfs序+树状数组2022-08-25 04:34:53

     链接:https://ac.nowcoder.com/acm/problem/204871 来源:牛客网 题目描述 已知有 nnn 个节点,有 n−1n-1n−1 条边,形成一个树的结构。 给定一个根节点 kkk,每个节点都有一个权值,节点i的权值为 viv_ivi​。 给 mmm 个操作,操作有两种类型: 1

  • 第五周专题(8.8-8.14):数学(8/15)2022-08-24 13:01:42

    第五周专题(8.8-8.14):数学 比赛链接 线性代数 A题 轮状病毒(递推,DP,矩阵树定理) 这题是可以暴力打表找规律来求通项,或者硬推出 DP 方程,但是作为数学场的第一题,我们还是小小思考一下这题背后的数学性质:矩阵树定理。 定义 \(G\) 是一个 \(n\) 顶点的无向图,那么有度数矩阵 \(D(G)\) 为: \[D

  • CF609E Minimum spanning tree for each edge 【最小生成树+树链剖分】2022-08-24 11:02:58

    CF609E Minimum spanning tree for each edge 题目描述 给你 \(n\) 个点,\(m\) 条边,如果对于一个最小生成树中要求必须包括第 \(i (1 \le i \le m)\) 条边,那么最小生成树的权值总和最小是多少。 输入格式 第一行 \(n,m\) ,后面 \(m\) 行每行 \(u,v,w\) 代表一条边。 输出格式 \(m\)

  • 01分数规划2022-08-24 01:02:45

    01分数规划 经典例题:POJ2976 给定 \(n\) 个物品的价值 \(a\) 和 花费 \(b\) ,取其中的 \(k\) 个物品,求 \(\sum a[i] / \sum b[i]\) 的最大值。 题解: 假设 \(\sum a[i] / \sum b[i] = x\) ,则: 当 \(x\) 不是最优解时,\(\sum a[i] / \sum b[i] \ge x\) 成立,则存在一种组合使 \(\sum(a[

  • 将时间转换为时间戳2022-08-23 19:31:59

    /** * 将时间转换为时间戳 * * @param s 2019-03-01 18:00:00 * @return res */ public static String dateToStamp(String s) { String res = null; Date date; SimpleDateFormat simpleDateFormat = new SimpleDateFo

  • [Express] Extends CrudController with Mongoose model2022-08-23 19:30:33

    Each model controller: import { crudControllers } from '../../utils/crud' import { Item } from './item.model' export default crudControllers(Item) You are able to override default methods from crudController: export default { ...cru

  • 校园内的汽车2022-08-23 13:31:12

    https://www.acwing.com/problem/content/description/1587/ 思路: 电话记录的模型,先筛选出所有符合要求的记录,之后按照题目要求做即可。 #include <iostream> #include <cstring> #include <algorithm> #include <unordered_map> #include <vector> using namespace std; st

  • go 查询es数据神器2022-08-23 12:01:10

    可以通过关键字和时间间隔进行查询,关键字可以像kibana上的查询语句填写,代码搞起 //搜索返回的内容 type Result struct { Message string `json:"message"` Source string `json:"source"` //Host string `json:"host"` } type SearchEs struct { } func NewSearchEs() *S

  • PAT Advanced 1024 Palindromic Number(25)2022-08-22 22:05:12

    题目描述: A number that will be the same when it is written forwards or backwards is known as a Palindromic Number. For example, 1234321 is a palindromic number. All single digit numbers are palindromic numbers. Non-palindromic numbers can be paired with pali

  • PAT 计数2022-08-22 21:00:09

    https://www.acwing.com/problem/content/1585/ 状态机的解法 #include <iostream> #include <cstring> using namespace std; const int N = 100010, MOD = 1e9 + 7; int n; char s[N], p[] = " PAT"; int f[N][4]; int main() { cin >> s +

  • 为什么渲染的时候,明明ajax请求没问题,模板引擎也没问题,却没有呢(layui加template)2022-08-22 12:35:02

    这是因为layui的渲染机制造成的,你在加载的时候是空的,然后你模板获取到之后,已经渲染结束了,所以啥也没有,这个时候我们需要重新渲染一下 //初始化文章分类 function initCate() { $.ajax({ method: 'GET', url: '/my/article/cates',

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

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

ICode9版权所有