ICode9

精准搜索请尝试: 精确搜索
  • 缓存管理算法LRU/LFU C++实现2022-01-12 21:03:06

    Cache缓存管理算法: 详见(7条消息) 计组——彻底搞懂cache主存映射cache容量及cache写策略_vavid的专栏-CSDN博客_cache容量 LRU-Least  Recently Used 最常用的缓存管理算法,目标时间复杂度,查询=O(1),添加=O(1);  实现方式:unordered_map<int,list<pair<int,int>>::iterator>M保存

  • leetcode334 (2022.1.12)2022-01-12 13:30:30

    bool increasingTriplet(vector<int>& nums) { int first, second, num; if (nums.size() < 3) { return false; } first = nums[0]; second = 0x7fffffff; for (int i = 1; i < nums.size(); i++) { if (nums[i] > second) { return tru

  • (一)路径规划算法---Astar C++实现及显示2022-01-11 21:31:32

    路径规划算法—Astar C++实现及显示 文章目录 路径规划算法---Astar C++实现及显示1.主函数2.地图数据的读取3.Astar算法的实现4.显示功能的实现5.算法仿真 以下均为原创的内容,转载请著名出处,谢谢。 1.主函数 main.cpp 主函数主要提供实现算法的对外接口,这里主要的流程

  • LeetCode 热题 HOT 100 第8天: “三数之和”2022-01-11 14:00:59

    继续刷LeetCode 热题 HOT 100 的题目,并且在博客更新我的solutions。在csdn博客中我会尽量用文字解释清楚,相关Java代码大家可以前往我的个人博客jinhuaiyu.com中查看。 今天的题目是涉及到两个点,一个是探索题目背后的数学关系,另一个是巧用排序。 题目:三数之和 给你一个包含 n

  • Android中activity的跳转 显示启动和隐式启动2022-01-10 00:00:34

    第一步 在layout中创建activity_second <TextView android:id="@+id/tv_1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="界面1" tools:layout_editor_absoluteX="1

  • LeetCode.781 森林中的兔子2022-01-07 12:01:23

    题目描述: 森林中有未知数量的兔子。提问其中若干只兔子 "还有多少只兔子与你(指被提问的兔子)颜色相同?" ,将答案收集到一个整数数组 answers 中,其中 answers[i] 是第 i 只兔子的回答。 给你数组 answers ,返回森林中兔子的最少数量。   理解此题的关键是: 1、说出与自己颜色相同兔子

  • 7-24 热点新闻2022-01-02 17:59:36

    #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #include<map> #include<queue> using namespace std; struct news{ string tp,tim,s[55]; int cnt; }a[10005]; struct ac{ string s; int sum;

  • JS返回当前时间(年、月、日、时、分、秒)2022-01-02 02:03:30

    function getDateTime() { var date = new Date(), year = date.getFullYear(), month = date.getMonth() + 1, day = date.getDate(), hour = date.getHours() + 1, minute = date.getMinutes(), second = date.getSeconds(); month = checkTime(month); day = chec

  • 实时闹钟(Python)2022-01-01 20:01:39

    请确保你的电脑时间是准的! from turtle import * from datetime import datetime def jump(distanz, winkel=0):     penup()     right(winkel)     forward(distanz)     left(winkel)     pendown() def hand(laenge, spitze):     fd(laenge*1.15)     rt(90)

  • KMP算法代码2022-01-01 16:32:42

    #include<bits/stdc++.h> using namespace std; #define int long long pair<string,int> SqString; void GetNext(pair<string,int> SqStringt,int next[]){ int j,k; j=0,k=-1; next[0]=-1; while(j<(SqString.second)-1){ if(k==-1||SqStrin

  • LeetCode 19 删除链表的倒数第N个节点(C语言 快慢指针法 简单易懂)2021-12-30 21:33:04

    题目: 给你一个链表,删除链表的倒数第 n 个结点,并且返回链表的头结点。 示例1: 输入:head = [1,2,3,4,5], n = 2 输出:[1,2,3,5] 示例2: 输入:head = [1], n = 1 输出:[] 示例3: 输入:head = [1,2], n = 1 输出:[1] 提示: 链表中结点的数目为 sz 1 <= sz <= 30 0 <= Node.val <

  • canvas_08 数字时钟2021-12-27 02:03:08

    效果图: 1 <!DOCTYPE html> 2 <html lang="en"> 3 4 <head> 5 <meta charset="UTF-8"> 6 <meta http-equiv="X-UA-Compatible" content="IE=edge"> 7 <

  • 1078. Bigram 分词2021-12-26 20:35:28

    1078. Bigram 分词 查看原题 解题思路 将句子按空格分隔开 遍历寻找符合条件的就行 代码 /** * @param {string} text * @param {string} first * @param {string} second * @return {string[]} */ var findOcurrences = function(text, first, second) { let thirdWord

  • 实现倒计时功能2021-12-26 20:06:08

    效果图:  代码: <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title></title> <style type="text/css"> .box{ width: 170px; margin: 0 auto; border-radius: 10px; text-a

  • [LeetCode]1078.Bigram分词2021-12-26 15:31:16

    [LeetCode]1078.Bigram分词 题目示例方法一次遍历 题目 给出第一个词 first 和第二个词 second,考虑在某些文本 text 中可能以 “first second third” 形式出现的情况,其中 second 紧随 first 出现,third 紧随 second 出现。 对于每种这样的情况,将第三个词 “third” 添加

  • LeetCode刷题NO.1078——Bigram 分词2021-12-26 15:03:10

    来源:力扣(LeetCode) 链接:https://leetcode-cn.com/problems/occurrences-after-bigram 【题目描述】 给出第一个词 first 和第二个词 second,考虑在某些文本 text 中可能以 “first second third” 形式出现的情况,其中 second 紧随 first 出现,third 紧随 second 出现。 对于每种

  • 力扣每日一题(二十一)2021-12-26 10:00:17

    仅以此纪录每日LootCode所刷题目 题目描述: 示例:   思路: 这道题的解题思路比较容易想出,首先我们需要将空格当成分隔符把text字符串分开,将每个单词加入到列表中。之后即可开始循环判断,当第i个单词为first时,若第i+1个单词为second,则在输出列表中加入第i+2个单词,注意控制好循环的

  • C++的数据类型操作 - map2021-12-24 09:35:33

    使用C++做算法题时,与map相关的常用操作: C++的map底层使用红黑树对key进行排序。unordered_map底层使用哈希表存储,所以key无序。 map的{key,value}对实际上是pair< classtype, classtype>。 头文件 #include <map> 创建 map[key] = v; // 如果没有创建过,那么自动创建

  • goroutine中再创建一个goroutine2021-12-23 22:06:18

    文章目录 前言代码goroutine原理 前言 今天写代码的时候突发奇想goroutine中是否可以再运行一个goroutine,初步的想法是可以的,因为main函数运行的时候其实是一个主goroutine,在主goroutine里面再运行一个goroutine是没问题的,那么我们一个普通的goroutine运行一个goroutine

  • 【CF3C Tic-tac-toe】题解2021-12-23 19:04:32

    题目链接 题目 Certainly, everyone is familiar with tic-tac-toe game. The rules are very simple indeed. Two players take turns marking the cells in a 3 × 3 grid (one player always draws crosses, the other — noughts). The player who succeeds first in placin

  • js倒计时2021-12-18 21:04:54

    解题思路:利用JS的Date构造函数 获取当前时间 然后在设定目标时间  剩余时间 = 结束时间 - 当前时间 也就实现了倒计时的功能 具体参考一下代码! window.onload = function() { // 找到 小时 分钟 秒钟的标签 let [h, m , s] = document.querySelectorAll('.time s

  • ValueError: shapes (3,3) and (0,) not aligned: 3 (dim 1)2021-12-13 23:59:03

    ValueError: shapes (3,3) and (0,) not aligned: 3 (dim 1) != 0 (dim 0) 参考:https://stackoverflow.com/questions/39608421/showing-valueerror-shapes-1-3-and-1-3-not-aligned-3-dim-1-1-dim-0 The column of the first matrix and the row of the second matrix shoul

  • Codeforces Round 758 (Div.1 + Div.2) 解题报告2021-12-13 14:01:52

    传送门 \(\rm Codeforces ~ Round ~ 758 ~ (Div.1 + Div.2)\) A. Find Array 给定 \(n\),试找出 \(n\) 个数 \(a_1,a_2, \cdots,a_n\),满足: \(\forall 1 \leq i \leq n,1 \leq a_i \leq 10^9\)。 \(a_1 < a_2 < \cdots < a_n\) \(\forall 2\leq i \leq

  • CF1608C2021-12-12 19:32:50

    题意: 给定 \(n\) 个人分别在两张地图上的能力值,每次选出其中两人在任意地图上战斗,能力值低者被淘汰,获胜者为最后没被淘汰的那个人,问那些人可以通过控制比赛获胜,那些人一定无法获胜 思路: 考虑那些必败者,要么打不过任何人,要么能打过的人打不过任何人,要么能打过的人能打过的人打不过

  • 题解-12/09 模拟赛2021-12-09 22:01:04

    whk 复健赛,手速和脑子都不够 A - Weather Report「ICPC World Finals 2015」 一开始读错了,以为是每种天气一个,其实是对于 \(4^n\) 种天气各一个。直接算出每种序列出现的权重,这可以直接枚举每种天气的天数然后可重接排列数合并。然后考虑哈夫曼树,每次找到两个最小的合并起来。这题

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

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

ICode9版权所有