ICode9

精准搜索请尝试: 精确搜索
  • NC16886 [NOI2001]炮兵阵地2022-09-02 20:01:19

    题目链接 题目 题目描述 司令部的将军们打算在N*M的网格地图上部署他们的炮兵部队。一个N*M的地图由N行M列组成,地图的每一格可能是山地(用"H" 表示),也可能是平原(用"P"表示),如下图。在每一格平原地形上最多可以布置一支炮兵部队(山地上不能够部署炮兵部队);一支炮兵部队在地图上的攻击范

  • stackstorm webui安装2022-08-15 00:32:35

    stackstorm webui安装 1 配置账号和密码 yum -y install httpd-tools #添加账号st2admin密码Ch@ngeMe,用来登录WEBUI echo 'Ch@ngeMe' | sudo htpasswd -i /etc/st2/htpasswd st2admin #[auth] enable = True 修改【auth】下的enable的值为True即可 vim /etc/st2/st2.conf

  • [LeetCode] 1305. All Elements in Two Binary Search Trees 两棵二叉搜索树中的所有元素2022-05-29 14:32:42

    Given two binary search trees root1 and root2, return a list containing all the integers from both trees sorted in ascending order. Example 1: Input: root1 = [2,1,4], root2 = [1,0,3] Output: [0,1,1,2,3,4] Example 2: Input: root1 = [1,null,8], root2

  • LeetCode(32)2022-01-02 20:02:12

    class Solution { public: int longestValidParentheses(string s) { int n = s.size(),i = 0,maxResult = 0,result = 0,t,tmax,tsum; if(n==0)return 0; stack<char>st; stack<int>st2; while(i!=n||!st.empty()){

  • 判断是否互为字符串重排2021-12-25 11:04:37

    输入两个字符串,分别为s1和s2,将其中一个重新排序后是否与另一个字符串相等 num = 0x = 0s1 = input('请输入字符串1:')s2 = input('请输入字符串2:')st1 = list(s1)st2 = list(s2)while True: if st1 == []: break if x == len(st2): num = 1 break e

  • Leetcode NO.232 Implement Queue Using Stacks 使用栈实现队列2021-12-08 17:35:21

    目录1.问题描述2.测试用例示例 13.提示4.代码1.入队反转code复杂度2.出队反转code复杂度 1.问题描述 请你仅使用两个栈实现先入先出队列。队列应当支持一般队列支持的所有操作(push、pop、peek、empty): 实现 MyQueue 类: void push(int x) 将元素 x 推到队列的末尾 int pop() 从队列

  • 5 个刁钻的 String 面试题2021-11-08 19:01:05

    这篇来看看关于 Java String 类的 5 道面试题,这五道题,我自己在面试过程中亲身经历过几道题目,本篇就带你了解这些题的答案为什么是这样。 1.判定定义为String类型的st1和st2是否相等,为什么 package string; public class Demo2_String {   public static void main(

  • 自定义排序规则的multiset用法(1)2021-10-25 19:34:25

    #include<iostream> #include<cstring> #include<set> using namespace std; struct Rule1 { bool operator()(const int& a, const int& b)const { return (a % 10) < (b % 10); }//返回值为true则说明a必须排在b前面 }; int main() { m

  • matlab 二次指数平滑法预测2021-07-24 16:29:45

    二次指数平滑法预测 clc,clear ;//清空命令行,工作区 load pre1.txt %原始数据以列向量的方式存放在纯文本文件中 yt=pre1; n=length(yt); alpha=0.3; st1(1)=yt(1); st2(1)=yt(1); for i=2:n st1(i)=alpha*yt(i)+(1-alpha)*st1(i-1); st2(i)=alpha*st1(i)+(1-alpha)*st2

  • Python常见数据类型及使用方法2021-07-16 10:04:19

    基本数据类型 基本数据类型(8种) 整型(int) 浮点型(float) 字符串(str) 列表(list) 元祖(tuple) 字典(dict) 集合(set) 布尔(bool) 数据类型分类 字节类型表示 a=bytes('123') or a=b'123' 字节数组 bytearray('123') 可变序列 列表[],集合{},字典{"key":'value'}

  • C#基础(二):enum与struct2021-06-02 19:52:49

    枚举类型/*       C#枚举体的应用    */ using System; namespace ConsoleApp1 {     class Program     {         enum State         {             OnLine,             OffLine,             busy,

  • HDU5058(set应用)2021-02-23 11:32:49

    #include<iostream> #include<algorithm> #include<cstring> #include<cmath> #include<set> using namespace std; int n; int main(){ while(cin>>n){ set<int>st1; set<int>st2; for(int i=1;i<=n;i++){ int

  • python中字符串常用操作方法2021-01-16 18:33:52

    // A code block var foo = 'bar'; // An highlighted block #字符传拼接的三种方式 name='herosnown' #1 st='%s我要学python'%name #st=herosnown我要学python st='%s我要学%spython'%(name,name) #st=herosnown我要学herosnownpython #2 c,h,t=

  • LeetCode 1046. 最后一块石头的重量2020-12-30 20:30:05

    题目 有一堆石头,每块石头的重量都是正整数。 每一回合,从中选出两块 最重的 石头,然后将它们一起粉碎。假设石头的重量分别为 x 和 y,且 x <= y。那么粉碎的可能结果如下: 如果 x == y,那么两块石头都会被完全粉碎; 如果 x != y,那么重量为 x 的石头将会完全粉碎,而重量为 y 的石头新

  • leetcode:剑指 Offer 09. 用两个栈实现队列(简单,)2020-12-13 20:30:17

    题目: 分析:自己的做法,st1打主攻,st2打辅助 插入元素,直接插入到st1中,弹出元素,st1中的全部弹出到st2中,除了第一个再弹回到st1中。 class CQueue { public: stack<int> st1,st2; //st1存储,st2辅助 CQueue() { while(!st1.empty()) st1.pop(); while(!

  • C#计算时间差2020-09-09 09:00:54

    C#计算时间差 string st1="12:13"; string st2="14:14"; DateTime dt1=Convert.ToDateTime(st1); DateTime dt2=Convert.ToDateTime(st2); DateTime dt3=DateTime.Now; if(DateTime.Compare(dt1,dt2)>0) msg.Text=st1+">"+st2; else msg.Text

  • 567. Permutation in String2020-09-02 05:31:19

    Given two strings s1 and s2, write a function to return true if s2 contains the permutation of s1. In other words, one of the first string's permutations is the substring of the second string.   Example 1: Input: s1 = "ab" s2 = "eidbao

  • STL(标准模板库)笔记——平衡二叉树multiset2020-06-17 21:03:47

    STL(标准模板库)笔记---平衡二叉树multiset 本系列是观看北大郭炜老师程序与算法课程的笔记,用于复习与巩固。 STL中的平衡二叉树数据结构 有时需要在大量增加、删除数据的同时, 还要进行大量数据的查找 希望增加数据、删除数据、查找数据都能在 log(n)复杂度完成 排序+二分查找显

  • Java实现 蓝桥杯 算法提高 八数码(BFS)2020-04-29 14:03:05

    试题 算法提高 八数码 问题描述   RXY八数码 输入格式   输入两个33表格   第一个为目标表格   第二个为检索表格 输出格式   输出步数 样例输入 1 2 3 4 5 6 7 8 0 1 2 3 4 5 6 7 0 8 样例输出 1 数据规模和约定   33*2 PS: 花里胡哨得,直接套代码搜 import j

  • MATLAB 时间序列预测算法的实现2020-01-27 17:43:48

    最近看了一篇关于时间序列模型的论文 以下是关于matlab代码的部分各个方法都有实现 觉得还是这样用起来方便 %平均移动法 %clc; %clear all; %y=[533.8 574.6 606.9 649.8 705.1 772.0 816.4 892.7 963.9 1015.1 1102.7]; %m=length(y); %n=[4,5]; % 自定义 %for i=1:lengt

  • 结构体2019-12-01 11:51:11

    一 赋值和初始化 # include <stdio.h> struct Student//只是定义了一个数据类型,并没有定义变量 { int age; float score; char sex; } ; int main () { //类似于数组 struct Student st1={80,66.6,'F'};//初始化 定义的同时赋初值 struct Student st2;

  • [Cometoj#4 E]公共子序列_贪心_树状数组_动态规划2019-10-23 16:02:38

    公共子序列 题目链接:https://cometoj.com/contest/39/problem/E?problem_id=1585 数据范围:略。 题解: 首先可以考虑知道了$1$的个数和$3$的个数,怎么求? 其实就是从开始找$x$个$1$,从结尾找$z$个$3$,然后两个序列中间$2$的个数的较小值。 然后按照官方题解那样推式子,发现可以用树状数

  • SCUT - 86 - 加农! = 数学常识 + 栈2019-10-17 18:55:12

    https://scut.online/p/86 题意:给5e6个数,选一段最小的[l,r],使得其中的数线性组合可以取遍整数。 显然当且仅当gcd为1的时候就可以遍历所有整数。 问题变成怎么求一段连续区间的gcd,可以用队列来尺取。 但是弹出元素的时候没办法记录逆操作,所以可以用两个栈实现一个队列,只需要满足结

  • 孩子: DEV C++ 高精度 减法2019-08-08 22:02:38

    #include<bits/stdc++.h>using namespace std;int a[1005]={0},b[1005]={0},c[1005]={0};string st1,st2;int main(){ cin>>st1>>st2; int len1=st1.size(); int len2=st2.size(); int fh=0,l,zh=0,k=0; //cout<<st1<<endl<&

  • LeetCode 165. 比较版本号2019-08-05 13:36:00

    比较两个版本号 version1 和 version2。 如果 version1 > version2 返回 1,如果 version1 < version2 返回 -1, 除此之外返回 0。 你可以假设版本字符串非空,并且只包含数字和 . 字符。  . 字符不代表小数点,而是用于分隔数字序列。 例如,2.5 不是“两个半”,也不

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

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

ICode9版权所有