ICode9

精准搜索请尝试: 精确搜索
  • leetcode1790-仅执行一次字符串交换能否使两个字符串相等2022-09-03 17:30:20

        int count=0,sizes=s1.size(),sum1=0,sum2=0;         for(int i=0;i<sizes;i++)         {             if(s1[i]!=s2[i])    count++;             sum1 += s1[i];             sum2 += s2[i];    

  • 2019ACM-ICPC 西安邀请赛 D.Miku and Generals——二分图染色+01背包2022-09-03 11:34:44

    目录题意思路代码 目录 题意 将n个将军卡片分成两份,要求两份卡片之间的差值尽可能小,求最大的那一份卡片的和,这里有m组卡片是不能放在同一份的 思路 对有矛盾的组我们建图进行01染色,对于每一个连通块得到所有的0点和1点的差值的绝对值,我们存在数组ve中,单点也加入ve中,相当于一份是x

  • LeetCode 854. K-Similar Strings2022-08-29 05:30:44

    原题链接在这里:https://leetcode.com/problems/k-similar-strings/ 题目: Strings s1 and s2 are k-similar (for some non-negative integer k) if we can swap the positions of two letters in s1 exactly k times so that the resulting string equals s2. Given t

  • 1012 The Best Rank (25分)2022-08-28 00:03:22

    To evaluate the performance of our first year CS majored students, we consider their grades of three courses only: C - C Programming Language, M - Mathematics (Calculus or Linear Algrbra), and E - English. At the mean time, we encourage students by emph

  • 集合2022-08-27 23:01:25

    1、创建集合   创建集合使用{ }或set(),但是如果要创建空集合只能使用set(),因为{ }用来创建空字典。   特点:     1. 集合可以去掉重复数据;     2. 集合数据是无序的,故不支持下标。 s1 = {10, 20, 30, 40, 50} # 无序 # 结果:{50, 20, 40, 10, 30} print(s1) s2 = {10, 20

  • [Oracle] LeetCode 415 Add Strings2022-08-26 06:00:34

    Given two non-negative integers, num1 and num2 represented as string, return the sum of num1 and num2 as a string. You must solve the problem without using any built-in library for handling large integers (such as BigInteger). You must also not convert th

  • ESP32-S2 lwip2022-08-25 19:32:09

    I'm not a big expert in lwIP, but I think the code is correct, since I spent time debugging it on ESP32 and it works very well there. If one code for transmitting data over TCP over WiFi works on ESP32 and does not work on ESP32-S2, I tend to think t

  • ESP32-S2上使用SPI接口芯片DM9051NP转以太网的无线物联网网关开发指导2022-08-25 12:30:34

    (98条消息) ESP32-S2上使用SPI接口芯片DM9051NP转以太网的无线物联网网关开发指导_qq1667532的博客-CSDN博客_spi转以太网芯片

  • 哈希2022-08-25 09:01:53

    哈希 字符串哈希 分析 定义一个进制b,b必须大于字符种数且为素数(玄学吧) 。然后将字符串的每位字符的ascii码当做进制的方法一样算成一个数。 想一下我们如何求出二进制中每位的数字?除一下存入数组,再模一下,知道数为 0 。 字符串哈希也是这个思路:要求一个字符串在另一个长字符串中

  • Golang中slice操作的一些问题2022-08-21 11:33:44

    package go_tests import ( "bytes" "fmt" "testing" ) // 值类型与引用类型 func TestT55(t *testing.T) { a := 123 b := a // 指向不同的内存地址 fmt.Printf("a: %d, %p \n", a, &a) // a: 123, 0xc00000a338

  • "蔚来杯"2022牛客暑期多校训练营3 C-Concatenation2022-08-20 18:31:27

    问题描述 NIO was the king of the OIN Kingdom. He had NNN children and wanted to teach them how to count. In the OIN Kingdom, pental is used in counting, so his children can only use 0, 1, 2, 3, and 4 to represent a number. One day, NIO asked his children to w

  • P5681 [CSP-J2019 江西] 面积2022-08-18 00:32:44

    题目描述 Alice 有一个边长为 aa 的正方形,Bob 有一个长宽分别为 b,cb,c 的矩形,请你告诉他们俩谁的图形面积更大。 输入格式 仅一行三个正整数 a,b,ca,b,c 输出格式 输出仅一行一个字符串,若正方形面积大则输出 Alice,否则输出 Bob。 输入输出样例 输入  5 4 6 输出

  • 学习:python 内置模块 time2022-08-17 20:03:51

    import time s1=time.time()#获取一个时间戳:当前时间距离1979年元旦0时的秒数,用户计算程序执行秒数 开始前记录一次 结束后记录一次 相减 for x in range(1,10001): print(x) s2= time.time() print(s) print(s2-s1) t= time.localtime() #获取当前本地的日期和时间 print(t

  • 学习:python 内置模块datetime2022-08-17 20:00:42

    import time import datetime #获取当前的日期时间 n=datetime.datetime.now() print(n) #获取一个指定时间 da=datetime.datetime(2018,2,13,5,23,45) print(da) #日期转字符串 s1=d1.strftime("%Y-%m-%d %H%M%S") print(s1) #字符串转成日期 s2="2018/02/13 05:23:45" datet

  • leetcode87-扰乱字符串2022-08-17 12:33:18

    扰乱字符串 dp dp需要记录s1和s2的起始位置和长度,所以是一个三维dp。 dp[i1][i2][len]表示s1从i1位置开始,s2从i2位置开始,长度为len的两个字符串是否和谐。分为以下几种情况: 如果两个字符串相等,返回true 如果字符串不相等,那么从1到len-1的范围内,找出分割点i。如果dp[i1][i2][i]

  • 什么是谓词下推,看这一篇就够了2022-08-16 02:01:36

    目录1.什么是谓词2.什么是下推3.什么是谓词下推4.一些常见的应用4.1传统数据库应用4.2Hive中的谓词下推4.3列式存储中的谓词下推 今天有个小伙伴问我,什么是谓词下推,然后我就开启巴拉巴拉模式,说了好长一段时间,结果发现他还是懵的。 最后我概述给他一句话:所谓谓词下推,就是将尽可能多

  • 最长公共子序列2022-08-15 22:32:25

    前缀型动态规划 def longest_common_seq(s1, s2): if not s1 or not s2: return m, n = len(s1), len(s2) # dp[i][j] = max(dp[i-1][j], dp[i][j-1], dp[i-1][j-1]),当前字符依赖于i-1和j-1,需要补一个状态零 dp = [[0]*(n+1) for _ in range(m+1)]

  • 面向对象:多态2022-08-13 19:01:06

    多态 就是同一个方法根据不同的发送对象而采取多种不同的操作(属性没有多态!) 一个对象的实际类型是确定的 例如:new Person(); newStudent(); 但是可以指向对象的引用的类型有很多 例如: Student继承了Person类 Student s1 = new Student(); Person s2 = new Stud

  • 一:明天2022-08-13 08:32:51

    https://s2.loli.net/2022/08/13/2t4DgXy8KOJMUbo.jpg

  • POJ1458 Common Subsequence2022-08-11 21:01:04

    题目链接 题目 Description A subsequence of a given sequence is the given sequence with some elements (possible none) left out. Given a sequence X = < x1, x2, ..., xm > another sequence Z = < z1, z2, ..., zk > is a subsequence of X if there exists a

  • 1011 外挂 线段树 数学思维2022-08-08 21:32:38

     链接:https://ac.nowcoder.com/acm/contest/26896/1011来源:牛客网 题目描述 我的就是我的,你也是我的,记住了,狐狸!                                                                       ——韩信-白龙吟

  • 最长公共前缀2022-08-08 09:02:09

    14. 最长公共前缀 难度简单2380 编写一个函数来查找字符串数组中的最长公共前缀。 如果不存在公共前缀,返回空字符串 ""。   示例 1: 输入:strs = ["flower","flow","flight"] 输出:"fl" 示例 2: 输入:strs = ["dog","racecar","car"] 输出:"&qu

  • P8013 [COCI2013-2014#4] GMO 题解2022-08-07 21:04:50

    题目大意 给定一字符串,你需要在这个字符串中插入若干个字符,使字符串中包含目标字符串,并使花费的代价最少。 思路 由于这道题数据范围不是很大,\(( n ≤ 10000 )\) ,我们可以枚举以原字符串的每一个位置为开头的代价,维护一个最小值即可。 代码 #include<bits/stdc++.h> using names

  • 验证子串2022-08-07 10:32:09

    题目描述   输入两个字符串,验证其中一个串是否为另一个串的子串。 输入格式   输入两个字符串, 每个字符串占一行,长度不超过200且不含空格。 输出格式   若第一个串s1是第二个串s2的子串,则输出(s1) is substring of (s2)   否则,若第二个串s2是第一个串s1的子串,

  • 五、练习:高精度2022-08-06 21:07:33

    高精度 今天我们就说一件事:高精度。 高精度是什么玩意儿? 什么是高精度高精度算法?高精度算法属于处理大数字的数学计算方法。在一般的科学计算中,会经常算到小数点后几百位或者更多,当然也可能是几千亿几百亿的大数字。一般这类数字我们统称为高精度数,高精度算法是用计算机对于超大

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

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

ICode9版权所有