ICode9

精准搜索请尝试: 精确搜索
  • For循环2021-10-18 16:04:24

    For循环 练习 1 求100以内的奇数 偶数之和 public static void main(String[] args) {        //练习1求100以内的奇数 偶数之和        int oddsum=0;//奇数        int evensum=0;//偶数        for (int i=0 ;i<=100;i++){            //余数不为零的

  • LeetCode 11.盛最多水的容器【Java】2021-10-15 21:31:50

    目录 1.题目2.思路3.代码 1.题目 盛最多水的容器: 给你 n 个非负整数 a1,a2,...,an,每个数代表坐标中的一个点 (i, ai) 。在坐标内画 n 条垂直线, 垂直线 i 的两个端点分别为 (i, ai) 和 (i, 0) 。找出其中的两条线,使得它们与 x 轴共同构成的容器可以容纳最多的水。 说明:你不

  • Java工具类—包装类2021-10-14 13:00:07

    Java工具类——包装类 我们都知道,JDK 其实给我们提供了很多很多 Java 开发者已经写好的现成的类,他们其实都可以理解成工具类,比如我们常见的集合类,日期相关的类,数学相关的类等等,有了这些工具类,你会发现它能很大程度的帮你节省时间,能很方便的实现你的需求。当然,没有这些包,你也能实现

  • 关于 NAN 和 INF2021-10-11 01:01:14

    问题:       #include <stdio.h> #include <math.h> int main() { double a, b, c, x1, x2, i1, i2, san;//san求根的▲ x1<x2 scanf("%lf %lf %lf", &a, &b, &c); if (a == 0 && b == 0 && c != 0) printf(&quo

  • mysql建表时添加时间默认值只存储时分秒且自动存储2021-10-06 21:02:05

    mysql建表时添加时间默认值只存储时分秒且自动存储 CREATE TABLE IF NOT EXISTS THI( THIId INT UNSIGNED AUTO_INCREMENT, t1 INT UNSIGNED NOT NULL, h1 INT UNSIGNED NOT NULL, i1 INT UNSIGNED NOT NULL, dataTime TIME NOT NULL,/*只存储时分秒*/ PRIMARY KEY (T

  • 选择排序2021-10-06 20:31:06

    public class sort { //选择排序 public static void main(String[] args) { int[] array = {1, 2, 42, 52, 3, 32,};//定义一个数组。 //将第一个位置的元素和后面的所有元素对比,若比其中的一个大就交换位置。 for (int i = 0; i < array.length - 1;

  • 随便发布的2021-10-02 23:00:19

    public class HelloWorld { public static void main(String[] args) { //写单行注释 /* 中间写多行注释/ /** * .,:,,, .::,,,::. * .::::,,;;, .,;;:,,....:i: * :i,.::::,;i:

  • 每日一练_113(2021.10.1) 扰乱字符串(leetcode)。2021-10-01 20:34:41

    美好的一天从“困难”结束! 作者:LeetCode-Solution 链接:https://leetcode-cn.com/problems/scramble-string/solution/rao-luan-zi-fu-chuan-by-leetcode-solutio-8r9t/ 来源:力扣(LeetCode) 著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。 我自己举了好多例

  • LeetCode 678. 有效的括号字符串2021-09-13 00:00:57

    难度:中等 第一次中等题目时间击败100%的用户 解题思路: 以右括号为基准,先把右括号判断完,然后在看看有没有剩下的左括号,在进行左括号与*之间的比较,感觉这题算是一题比较简单的逻辑题,代码如下: class Solution { public boolean checkValidString(String s) { if (s.equa

  • 浅析Java并发编程:如何做到线程安全-Collections.synchronizedList和CopyOnWriteArrayList的选择2021-09-09 19:32:04

      在多线程环境下ArrayList是线程不安全的,所以需要使用线程安全的List,我第一时间使用的是Collections.synchronizedList(new Arraylist<>()),但是在实际使用过程中却发生了安全事件。 一、使用Collections.synchronizedList(new Arraylist<>()) + 同步解决线程安全问题   当前

  • JS实现汉字拼音转换2021-09-08 20:34:11

    如何用Js实现汉字转拼音?有一个比较简单的思路。(这里只实现了常用字的转换)。 1. 建立拼音与汉字的字库。 2.获取到字符串,逐字搜索,并设置首字母大写。 建立字库 汉字有21个声母:b, p, m, f, d, t, n, l, g, k, h, j, q, x, zh, ch, sh, r, z, c, s。 其中单韵母有6个:a, o, e, i, u,

  • 2021-09-07: python对中文名称重排序2021-09-08 00:02:27

    对中文名称重排序 import functools def cmp_str(s1, s2): pos1 = s1.find('-') pos2 = s2.find('-') i1 = int(s1[:pos1]) i2 = int(s2[:pos2]) if i1 < i2: return -1 if i1 > i2: return 1 return 0 wit

  • 拟阵拟阵交2021-09-05 13:02:45

    本文参考2018集训队论文《浅谈拟阵的一些拓展及其应用》 本文只有结论无证明,证明参考《浅谈拟阵的一些拓展及其应用》。 定义 对于一个集合 S {S} S,如果

  • 题解 UVA12727 The Sightseeing Tour2021-08-24 12:02:27

    题意 有 \(n\) 个景点,\(m\) 个望远镜,第 \(i\) 个望远镜的视野为 \([A_i,B_i]\) 中的景点,价格为 \(C_i\)。现在有 \(k\) 批游客,第 \(i\) 批游客有 \(Y_i-X_i+1\) 个人,分别愿意支付最多 \(X_i\sim Y_i\) 元钱。对于每个游客,你可以供给他一些可让他挑选的望远镜,他会选择能看到所有景

  • 【贪心】2021-08-20 19:33:02

      [1] K-Knowledge Test about Match_2021牛客暑期多校训练营1 (nowcoder.com) 随机化贪心 第一次遇到 1 #include <bits/stdc++.h> 2 using namespace std; 3 typedef long long ll; 4 const ll mx = 1e3 + 10; 5 int n, t; 6 inline double dd(int a, int b){ 7 r

  • 循环语句续2021-08-20 11:03:00

    循环语句续 要求输出一个*号组成的三角形。 代码如下: package com.cxf.Switch; public class Demo2 { public static void main(String[] args) { for (int i = 0; i < 5; i++) { for (int i1 = 0; i1 < 4 - i; i1++) { System.out.prin

  • School Method for Integer Addition and Karatsuba Algorithm for Integer Multiplication2021-08-19 10:04:02

    Your submission should contain exactly one file: main.cpp. You do not need to submit a design. Your program takes one line as input. The input line contains three integers separated by spaces. Let the three integers be I1, I2, and B. I1 and I2 are both no

  • 基于numpy用梯度上升法处理逻辑斯蒂回归2021-08-18 22:32:50

    import numpy as np  import matplotlib.pyplot as plt  w=700 w1=700 n=w1-50 train=np.random.randint(-300,300,(w,4)) train=train.astype(float) train_lable=np.zeros((w,1)) traint=train.astype(float) lam=100 for i in range(4):     train[:,i]=(train

  • 二维数组2021-08-14 11:01:56

    /** 测试二维数组 */ public class Test2DimensionArray { public static void main(String[] args) { //int[] i = new int[3]; //Car[] cars = new Car[3]; //二维数组静态初始化 int[][] i1 = new int[3][]; i1[0] = new int[]{20, 30};

  • Java之Integer$IntegerCache初探(AutoBoxCacheMax)2021-08-05 19:32:27

    JDK 8 ---   int是Java的基本数据类型,而Integer是其包装器类。 在创建Integer时,如果使用构造函数,则会在 堆中新建对象,而使用 valueOf的话,则 可能 会从其 内部类 IntegerCache 的 静态常量 cache 中获取数据。 “可能”是指 JDK默认情况下,cache中保存的数据是 -128~127,共计 256个I

  • LeetCode 1292. 元素和小于等于阈值的正方形的最大边长--前缀和2021-08-03 21:02:40

    元素和小于等于阈值的正方形的最大边长1292. 元素和小于等于阈值的正方形的最大边长 给你一个大小为 m x n 的矩阵 mat 和一个整数阈值 threshold。 请你返回元素总和小于或等于阈值的正方形区域的最大边长;如果没有这样的正方形区域,则返回 0 。 示例 1: 输入:mat = [[1,1,3,2,4

  • leetcode_743. 网络延迟时间--迪杰斯特拉2021-08-03 00:01:57

    leetcode_743 题目描述 题目大意 思路描述 代码 写在最后 题目描述 有 n 个网络节点,标记为 1 到 n。 给你一个列表 times,表示信号经过 有向 边的传递时间。 times[i] = (ui, vi, wi),其中 ui 是源节点,vi 是目标节点, wi 是一个信号从源节点传递到目标节点的时间。 现在,从

  • smo算法伪代码详细解释2021-08-01 13:01:01

    首先表明参数的解析公式: a2=a2+y2(E1-E2)/eta eta=x1*x1+x2*x2-2*x1*x2 伪代码: procedure takeStep (i1,i2)//利用解析式对参数进行更新,我比较推荐按李航统计学习的内容进行更新。 target = desired output vectorpoint = training point matrixprocedure takeStep(i1, i2) if

  • 练习16~2021-07-30 20:02:48

    normal16 password1 因为前面有个提取数字,所以可以确定这个六位密码都是数字,暴力即可 import hashlib a=[] for i in range(32,128): a.append(chr(i)) for i0 in a: for i1 in a: for i2 in a: for i3 in a: for i4 in a:

  • java中获得随机数2021-07-29 19:02:24

    public static void main(String[] args) { //创建随机数的对象 Random random = new Random(); int i = random.nextInt(); System.out.println(i); //在int范围内随机输出一个数 int 的范围是: -32768~32767 /* *

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

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

ICode9版权所有