P1004 方格取数(四维动归与斜线法)
题目描述设有 N \times NN×N 的方格图 (N \le 9)(N≤9) ,我们将其中的某些方格中填入正整数,而其他的方格中则放入数字 00 。如下图所示(见样例):A
0 0 0 0 0 0 0 0
0 0 13 0 0 6 0 0
0 0 0 0 7 0 0 0
0 0 0 14 0 0 0 0
0 21 0 0 0 ...
HDU 2256 矩阵快速幂
题目链接题意:计算Floor((sqrt(2)+sqrt(3))^(2n))mod1024。思路:(sqrt(2)+sqrt(3))^2 = (5+sqrt(24))^2因为(5+sqrt(24))和(5-sqrt(24))共轭,所以(5+sqrt(24))^n+(5-sqrt(24))^n为整数。因为5-sqrt(24)<1,所以(5-sqrt(24))^n<1,所以Floor( (...
4_1 偶数分解 (不明白为什么0)
歌德巴赫猜想:任何一个大于六的偶数可以拆分成两个质数的和,打印出所有的可能
输入n为偶数,输出n的所有分界可能
如输入
100
输出:
100=3+97
100=11+89
100=17+83
100=29+71
100=41+59
100=47+53
1
import java.util.Scanner;
public class Main {
public...
LeetCode: 142. Linked List Cycle II
LeetCode: 142. Linked List Cycle II
题目描述
Given a linked list, return the node where the cycle begins. If there is no cycle, return null.
Note: Do not modify the linked list.
Follow up:
Can you so...
LeetCode: Weekly Contest 92
LeetCode: Weekly Contest 92
题解列表
1. LeetCode: 868. Transpose Matrix 题解
第一题照例是签到题, 根据矩阵的转置定义,行列互换。
2.LeetCode: 866. Smallest Subtree with all the Deepest Nodes 题解
关于二叉树的题,照例用递归分治思想求解。
3. LeetCode...
LeetCode: 868. Transpose Matrix
LeetCode: 868. Transpose Matrix
题目描述
Given a matrix A, return the transpose of A.
The transpose of a matrix is the matrix flipped over it’s main diagonal, switching the row and column indices of th...
LeetCode: 866. Smallest Subtree with all the Deepest Nodes
LeetCode: 866. Smallest Subtree with all the Deepest Nodes
题目描述
Given a binary tree rooted at root, the depth of each node is the shortest distance to the root.
A node is deepest if it has the larg...
LeetCode: 867. Prime Palindrome
LeetCode: 867. Prime Palindrome
题目描述
Find the smallest prime palindrome greater than or equal to N.
Recall that a number is prime if it’s only divisors are 1 and itself, and it is greater than 1.
...
LeetCode: 143. Reorder List
LeetCode: 143. Reorder List
题目描述
Given a singly linked list L: L0→L1→…→Ln-1→Ln,
reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→…
You may not modify the values in the list’s nodes, only nodes itself may be c...
LeeCode:144. Binary Tree Preorder Traversal
LeeCode:144. Binary Tree Preorder Traversal
题目描述
Given a binary tree, return the preorder traversal of its nodes’ values.
Example:
Input: [1,null,2,3]
1
\
2
/
3
Output: [1,2,...
LeetCode: 865. Shortest Path to Get All Keys
LeetCode: 865. Shortest Path to Get All Keys
题目描述
We are given a 2-dimensional grid. "." is an empty cell, "#" is a wall,"@" is the starting point, (&am
LeetCode: 145. Binary Tree Postorder Traversal
LeetCode: 145. Binary Tree Postorder Traversal
题目描述
Given a binary tree, return the postorder traversal of its nodes’ values.
Example:
Input: [1,null,2,3]
1
\
2
/
3
Output: [...
springcloud使用Zuul构建微服务网关入门
为什么要使用微服务网关 不同的微服务一般会经过不同的网络地址,而外部客户端可能需要调用多个服务的接口才能完成一个业务需求。 如果让客户端直接与各个微服务通信,会有以下的问题: 客户端会多次请求不同的微服务,增加了客户端的复杂性。 存在跨域请求,在一定场景下处理相对复杂。 认证复杂,每个服务都需要独立认证。 难以重构,随着项目的迭代,可能需要重新划分微服务。例如,可能将多个服务整个成一个或者将一个服务拆分成多个。如果客户端直接与微服务通信,那么重构将会很难实施。 某些微服务可能使用了防火墙/浏览
C++ and Python
《父与子的编程之旅:与小卡特一起学Python》 The First The Second graphical user interface 图形用户界面(GUI) IDLE Python shell(Python GUI) Nginx 一个高性能的HTTP和 反向代理 服务器 Fedora [fi'dore]一个linux发行版 console 控制台 prompt [pra:mpt]迅速的,提示符 reserved world 保留字 execute [eksi kjut]执行 synon
GIT版本控制工具使用
基本命令 git init,初始化,表示即将对当前文件夹进行版本控制。 git status,查看Git当前状态,如:那些文件被修改过、那些文件还未提交到版本库等。 git add 文件名,将指定文件添加到版本库的暂存状态。 git commit -m '提交信息',将暂存区的文件提交到版本库的分支。 git log,查看提交记录,即:历史版本记录 git config --local user.name 'xxx' 设定用户名和邮箱 git config --local user.email
nodejs post请求
function form(callBack)
{
var data = {
username: 'admin',
password: "123"
};
var postData = require('querystring').stringify(data);
var options = {
method: "POST",
host: "test.notaryexpress.cn",
springcloud使用Hystrix实现微服务的容错处理
使用Hystrix实现微服务的容错处理 容错机制 如果服务提供者相应非常缓慢,那么消费者对提供者的请求就会被强制等待,知道提供者相应超时。在高负载场景下,如果不作任何处理,此类问题可能会导致服务消费者的资源耗尽甚至整个系统崩溃。 雪崩效应 微服务架构的应用系统通常包含多个服务层,微服务之间通过网络进行通信,从而支撑起整个应用系统,因此,微服务之间难免存在依赖关系。我们常把“基础服务故障”导致“级联故障”的现象成为雪崩效应。雪崩效应描述的是提供者不可用导致消费者不可用,并将不可用逐步扩大的过程。
springcloud中的负载均衡策略
IRule 这是所有负载均衡策略的父接口,里边的核心方法就是choose方法,用来选择一个服务实例。 AbstractLoadBalancerRule AbstractLoadBalancerRule是一个抽象类,里边主要定义了一个ILoadBalancer,就是我们上文所说的负载均衡器,负载均衡器的功能我们在上文已经说的很详细了,这里就不再赘述,这里定义它的目的主要是辅助负责均衡策略选取合适的服务端实例。 RandomRule 看名字就知道,这种负载均衡策略就是随机选择一个服务实例,看源码我
LeeCode: 3. Longest Substring Without Repeating Characters
LeeCode: 3. Longest Substring Without Repeating Characters
题目描述
Given a string, find the length of the longest substring without repeating characters.
Examples:
Given "abcabcbb", the answer is "...
今日推荐
周排行