ssr上google scholar 谷歌学术

问题

之前搭好的 VPN 用的好好的,但不能登录谷歌学术(Google Scholar),但是还能使用谷歌搜索等其他国外的网站。登录谷歌学术网站出现:We're sorry...... but your computer or network may be sending automated queries. To protect our users, we can't process your request right now.

原因

出现这个问题是因为我使用的是 Vultr 的 VPS 来搭建 shadowsocks 服务端,而且有很多人都在这些 VPS 服务商(Vultr,搬瓦工,DigitalOcean,Linode等等),然后有人使用这些公网的 IP 段来做爬虫,所以 Google 把这些公网 IP 给封了。但是一般封的都是 IPv4 的地址,IPv6 的地址一般没有被封,所以可以考虑使用 IPv6 来访问谷歌学术的网站。

阅读全文

【leetcode】 Median of Two Sorted Arrays

地址

https://leetcode.com/problems/median-of-two-sorted-arrays/description/ ## 题目 ### Median of Two Sorted Arrays There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)).

Example 1: nums1 = [1, 3] nums2 = [2] The median is 2.0

Example 2: nums1 = [1, 2] nums2 = [3, 4] The median is (2 + 3)/2 = 2.5

阅读全文

【Codeforces】#499 (Div. 2) D.Rocket

地址

[http://codeforces.com/contest/1011/problem/D][1]

题目

不放了,复制了格式各种乱

思路

看到n=30,最多让你问60次,肯定有问题 所以很容想到通过前n次每次询问1来判断说的是真是假,然后就是二分了

阅读全文

【codevs】1004 四子连棋

地址

http://codevs.cn/problem/1004/

题目

题目描述 Description 在一个4*4的棋盘上摆放了14颗棋子,其中有7颗白色棋子,7颗黑色棋子,有两个空白地带,任何一颗黑白棋子都可以向上下左右四个方向移动到相邻的空格,这叫行棋一步,黑白双方交替走棋,任意一方可以先走,如果某个时刻使得任意一种颜色的棋子形成四个一线(包括斜线),这样的状态为目标棋局。

● ○ ●
○ ● ○ ● ● ○ ● ○ ○ ● ○

输入描述 Input Description 从文件中读入一个4*4的初始棋局,黑棋子用B表示,白棋子用W表示,空格地带用O表示。 输出描述 Output Description 用最少的步数移动到目标棋局的步数。

样例输入 Sample Input BWBO WBWB BWBW WBWO 样例输出 Sample Output 5

阅读全文

【hdu】1667 The Rotation Game

地址

http://acm.hdu.edu.cn/showproblem.php?pid=1667

题目

The Rotation Game

Problem Description The rotation game uses a # shaped board, which can hold 24 pieces of square blocks (see Fig.1). The blocks are marked with symbols 1, 2 and 3, with exactly 8 pieces of each kind. Initially, the blocks are placed on the board randomly. Your task is to move the blocks so that the eight blocks placed in the center square have the same symbol marked. There is only one type of valid move, which is to rotate one of the four lines, each consisting of seven blocks. That is, six blocks in the line are moved towards the head by one block and the head block is moved to the end of the line. The eight possible moves are marked with capital letters A to H. Figure 1 illustrates two consecutive moves, move A and move C from some initial configuration. [图片]]2 Input The input consists of no more than 30 test cases. Each test case has only one line that contains 24 numbers, which are the symbols of the blocks in the initial configuration. The rows of blocks are listed from top to bottom. For each row the blocks are listed from left to right. The numbers are separated by spaces. For example, the first test case in the sample input corresponds to the initial configuration in Fig.1. There are no blank lines between cases. There is a line containing a single `0' after the last test case that ends the input.

Output For each test case, you must output two lines. The first line contains all the moves needed to reach the final configuration. Each move is a letter, ranging from A' toH', and there should not be any spaces between the letters in the line. If no moves are needed, output `No moves needed' instead. In the second line, you must output the symbol of the blocks in the center square after these moves. If there are several possible solutions, you must output the one that uses the least number of moves. If there is still more than one possible solution, you must output the solution that is smallest in dictionary order for the letters of the moves. There is no need to output blank lines between cases.

Sample Input 1 1 1 1 3 2 3 2 3 1 3 2 2 3 1 2 2 2 3 1 2 1 3 3 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 0 Sample Output AC 2 DDHH 2

Source 2004 Asia Regional Shanghai

阅读全文

【leetcode】Insert Interval

地址

https://leetcode.com/problems/insert-interval/description/

题目

Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary). You may assume that the intervals were initially sorted according to their start times.

Example 1: Input: intervals = [[1,3],[6,9]], newInterval = [2,5] Output: [[1,5],[6,9]]

Example 2: Input: intervals = [[1,2],[3,5],[6,7],[8,10],[12,16]], newInterval = [4,8] Output: [[1,2],[3,10],[12,16]] Explanation: Because the new interval [4,8] overlaps with [3,5],[6,7],[8,10].

阅读全文

Logstic Regression 原理与代码

Logstic Regression 模型

由线性回归的知识可知,线性回归方程为:\[y = \theta_0 + \theta_1 x_1 + \cdots + \theta_n x_n = \Theta^T X\] 而Logstic Regression就是在线性回归方程的基础上加上sigmoid的函数:$ y = $ Logstic Regression方程如所示:\[ h_\theta (x) = \frac{1}{1 + e^{-\Theta^T X}} \] 所以\(h_\theta (x)\)的结果是(0,1)之间的值。当\(h_\theta (x)\)大于0.5时,我们可以判定为正例,即\(y=1\);当\(h_\theta (x)\)小于0.5时,我们可以判定为负例,即\(y=0\);当\(h_\theta (x)\)等于0.5时,可任意判断

损失函数

通过概率论的极大似然估计,我们可以得到:\[ max L(x; \Theta) = \prod p(y_i | x_i, \Theta)\] 两边取对数: \[ \log(L(x; \Theta)) = \sum \log(p(y_i | x_i, \Theta)) \] 由Lostic Regression的方程可得:\[ p(y_i | x_i, \Theta) = h_\theta(x_i)^{y_i} \cdot (1-h_\theta(x_i))^{1-y_i} \] 带入化简可得:\[ J(\Theta) = \log(L(x; \Theta)) = \sum y_i\log(h_\theta(x_i)) + (1-y_i)\log(1-h_\theta(x_i))\] 求导得:\[ \frac {\partial J(\Theta)}{\partial \theta} = \sum (y-h_\theta(x))x \]

ps: 这符号好难打,再也不想写了

阅读全文

【leetcode】 N-Queens

地址

https://leetcode.com/problems/n-queens/description/

题目

The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other. 'one solution to the eight queens puzzle' Given an integer n, return all distinct solutions to the n-queens puzzle. Each solution contains a distinct board configuration of the n-queens' placement, where 'Q' and '.' both indicate a queen and an empty space respectively.

For example, There exist two distinct solutions to the 4-queens puzzle: [ [".Q..", // Solution 1 "...Q", "Q...", "..Q."], ["..Q.", // Solution 2 "Q...", "...Q", ".Q.."]]

阅读全文

【hihocoder】 1722 最小差值

地址

https://hihocoder.com/problemset/problem/1722

题目

时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 给定N个数组,每个数组都包含M个整数。
现在你被要求从每个数组中选出一个数,总共N个数,然后求出其中最大与最小的差值。
在MN种选法中,差值最小是多少?

输入 第一行包含两个整数N和M。
以下N行,每行包含M个整数。
对于50%的数据,1 ≤ N × M ≤ 10000
对于100%的数据,1 ≤ N × M ≤ 200000 0 ≤ 每个整数 ≤ 1000000 输出 最小的差值

样例输入 3 3
8 1 6
3 5 7
4 9 2 样例输出 2

阅读全文