ICode9

精准搜索请尝试: 精确搜索
  • n = 5x+2y+z2019-09-16 22:01:39

    求 n = 5x + 2y + z的全部非负整数解.例如n = 5时,有4组解:(0, 0, 5)、(0, 1, 3)、(0, 2, 1)、(1, 0, 0). 1.最普通的解法,三层循环遍历: int SolutionLoop(int n) { int x = n / 5; int y = n / 2; int z = n; int res = 0; for (int i = 0; i <= x; i++) { for (int j = 0;

  • jquery加载页面的方法(页面加载完成就执行)2019-09-06 16:07:18

    1、$(function(){   $("#a").click(function(){     //adding your code here   }); }); 2、$(document).ready(function(){   $("#a").click(function(){     //adding your code here     }); }); 3、window.onload = function(){   $("#a").cli

  • Python 條件式 Condition2019-08-20 17:02:44

    除了重複使用Function,有時我們須檢查結果,依此判斷下個步驟該怎麼進行,如此就需要條件式 condition statement。 if ... elif ... ese ( 或 if ... elif ...elif 或 if .. else ) >>> def numIsEven(k):...    if k % 2 == 0:...       print(k,' is even')...    else

  • 328. 奇偶链表2019-08-15 20:00:09

    给定一个单链表,把所有的奇数节点和偶数节点分别排在一起。请注意,这里的奇数节点和偶数节点指的是节点编号的奇偶性,而不是节点的值的奇偶性。请尝试使用原地算法完成。你的算法的空间复杂度应为 O(1),时间复杂度应为 O(nodes),nodes 为节点总数。//这题使用了三个指针(引用)一个odd指向

  • jQuery大法--选择器实验2019-08-14 19:37:36

     实验示例如下: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>实验</title> <style> table{ border: 0; border-collapse: collapse;

  • 328. Odd Even Linked List2019-08-08 12:56:14

    Given a singly linked list, group all odd nodes together followed by the even nodes. Please note here we are talking about the node number and not the value in the nodes. You should try to do it in place. The program should run in O(1) space complexity an

  • LeetCode328 奇偶链表2019-08-05 21:08:05

    原题目 给定一个单链表,把所有的奇数节点和偶数节点分别排在一起。请注意,这里的奇数节点和偶数节点指的是节点编号的奇偶性,而不是节点的值的奇偶性。 请尝试使用原地算法完成。你的算法的空间复杂度应为 O(1),时间复杂度应为 O(nodes),nodes 为节点总数。 示例 1: 输入: 1->2-

  • LeetCode 328——奇偶链表(JAVA)2019-08-01 15:01:46

    给定一个单链表,把所有的奇数节点和偶数节点分别排在一起。请注意,这里的奇数节点和偶数节点指的是节点编号的奇偶性,而不是节点的值的奇偶性。 请尝试使用原地算法完成。你的算法的空间复杂度应为 O(1),时间复杂度应为 O(nodes),nodes 为节点总数。 示例 1: 输入: 1->2->3->4->5->NULL

  • codeforces1196B Odd Sum Segments 思维2019-07-27 14:57:00

    网址:http://codeforces.com/contest/1196/problem/B 题意: 把$n$个数分成连续的且两两不相交的$k$段,要求每段的和都是奇数,若可以输出分法,不行输出$NO$。 题解: 贪心的取区间,偶数$+$偶数$=$偶数,偶数$+$奇数$=$奇数,奇数$+$奇数$=$偶数。所以(奇数个数$-k$)如果是奇数或者是负数,一定不行。

  • LeetCode 328:奇偶链表 Odd Even Linked List2019-07-20 10:02:08

    ​给定一个单链表,把所有的奇数节点和偶数节点分别排在一起。请注意,这里的奇数节点和偶数节点指的是节点编号的奇偶性,而不是节点的值的奇偶性。 请尝试使用原地算法完成。你的算法的空间复杂度应为 O(1),时间复杂度应为 O(nodes),nodes 为节点总数。 Given a singly linked list, grou

  • LeetCode-328 Odd Even Linked List2019-07-16 14:55:38

    题目描述 Given a singly linked list, group all odd nodes together followed by the even nodes. Please note here we are talking about the node number and not the value in the nodes. You should try to do it in place. The program should run in O(1) space complexi

  • 1116. Print Zero Even Odd2019-07-14 09:05:19

    Suppose you are given the following code: class ZeroEvenOdd {   public ZeroEvenOdd(int n) { ... }      // constructor   public void zero(printNumber) { ... }  // only output 0's   public void even(printNumber) { ... }  // only output even numbers

  • jquery针对单双行显示不同背景颜色2019-07-10 09:06:24

    原文链接:http://www.cnblogs.com/TSPWater/archive/2010/08/25/1808271.html //根据单双行显示不同背景色 $('#table tr:even').css('backgroundColor','#E8E6E1'); 文中odd:单行,even:双行 转载于:https://www.cnblogs.com/TSPWater/archive/2

  • 二分查找小结2019-07-07 09:00:31

    Templates These templates come from LeetCode. Tips The tip below comes from LeetCode 278. First Bad Version. If you are setting mid = (left+right) / 2, you have to be very careful. Unless you are using a language that does not overflow such as Python, le

  • LG3803 【模板】多项式乘法(FFT)2019-06-27 12:42:28

    P3803 【模板】多项式乘法(FFT) 注意:虽然本题开到3s,但是建议程序在1s内可以跑完,本题需要一定程度的常数优化。 题目描述 给定一个n次多项式F(x),和一个m次多项式G(x)。 请求出F(x)和G(x)的卷积。 输入输出格式 输入格式: 第一行2个正整数n,m。 接下来一行n+1个数字,从低到高表示F(x)的

  • May 26th, 2019. Week 22nd, Sunday2019-05-26 16:39:19

    A real loser is somebody that's so afraid of not winning, they don't even try. 真正的失败者,是那些因为害怕不能成功,就连试都不敢试的人。 It seems that this sentence comes from a movie named ' Little Miss Sunshine.' In the movie, it goes as following: What is a re

  • leetcode10542019-05-26 14:49:45

    1 from collections import Counter 2 3 class Solution: 4 def rearrangeBarcodes(self, barcodes: 'List[int]') -> 'List[int]': 5 n = len(barcodes) 6 c = Counter(barcodes) 7 sc = sorted(c.items(),key = lambd

  • bootstrap 轮播craousel 采坑之(修改默认鼠标浮动轮播不停止)2019-05-14 17:37:44

    首先上bootstrap 官网 https://v3.bootcss.com/javascript/#carousel  设置这个参数就可以,后面说如何采坑。见代码 html 部分 <!-- 轮播one --> <div id="myCarousel" class="carousel slide" data-ride="carousel" data-interval="2500">

  • 【Codeforces Gym 100739 A】Queries2019-05-11 22:41:46

    题意:给\(n\)个数\(a_{1..n}\),以及\(m\)个询问,每个询问如下: 1 p x表示把第\(p\)位上的数改成\(x\)。 2 a b表示找出\(\sum_{a\le l\le r\le b}a_l\ xor\ \ldots\ xor\ a_r\)。 思路:线段树。 首先肯定把位拆开来考虑,那么我们建\(10\)棵线段树。 每棵线段树需要维护什么呢? 首先肯定

  • HDU-5215 Cycle 无向图判奇环偶环2019-05-09 22:41:24

    题意:给一个无向图,判断这个图是否存在奇环和偶环。 解法:网上有一种只用dfs就能做的解法,但是我不太理解。 这里用的是比较复杂的。首先奇环很简单可以用二分图染色判断。问题是偶环怎么判断?这里我们想,一旦有两个环共享了一些点,那么这两个环一定能组成一个偶环。 那么我们考虑tarjan找

  • jQuery和js页面加载完成之后就执行的两种方法2019-05-06 12:44:43

    转自 http://www.jb51.net/article/27444.htm   jquery加载页面的方法(页面加载完成就执行),建议大家看下windows.onload与$(document).ready之间的区别。   1、$(function(){   $("#a").click(function(){     //adding your code here   }); }); 2、$(document)

  • python epoll方式tcp服务2019-04-24 18:38:48

    # -*- coding:utf-8 -*-import socketimport selectimport redef http_sever(new_socket, recv_data): recv_data_list = recv_data.splitlines() ret = re.match(r"[^/]+(/[^ ]*)", recv_data_list[0]) file_name = "" if ret: file_

  • Even Parity UVA - 11464 (枚举)2019-04-18 17:42:52

    从来没有觉得枚举有多费脑子的。但是这道题还是很香的。 思路:就是非常简单的枚举啦。   从一般的枚举开始考虑。一般的做法就是在所有的格子中有两种状态1, 0. 而一共有225个格子,所有一共要枚举的情况就是2255我们大概粗略的计算一下10大约是23则,时间复杂度大概是1085而实际的情况

  • 5.最长回文子串2019-04-18 11:52:35

    5.最长回文子串 题目描述 给定一个字符串 s,找到 s 中最长的回文子串。你可以假设 s 的最大长度为 1000。 示例 1: 输入: “babad” 输出: “bab” 注意: “aba” 也是一个有效答案。 示例 2: 输入: “cbbd” 输出: “bb” C++ 动态规划,dp[i][j]表示从i到j的是否是回文串 dp

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

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

ICode9版权所有