a/4)n^2<=an^2+bn+c<=(7a/4)n^2 ,求解出n

a/4)n^2<=an^2+bn+c<=(7a/4)n^2 ,求解出n,出于《算法导论》函数的增长p27。不知道书上n0=2*max(|b|/a,√(|c|/a))是如何得出max里面的式子的，求解答

a/4)n^2<=an^2+bn+c<=(7a/4)n^2 ,求解出n

a/4)n^2<=an^2+bn+c<=(7a/4)n^2 ,求解出n,出于《算法导论》函数的增长p27。不知道书上n0=2*max(|b|/a,√(|c|/a))是如何得出max里面的式子的，求解答

Problem Description 给定序列A={A1,A2,...,An}, 要求改变序列A中的某些元素，形成一个严格单调的序列B（严格单调的定义为：Bi<Bi+1,1≤i<N）。 我们定义从序列A到序列B变换的代价为cost(A,B)=max(|Ai−Bi|)(1≤i≤N)。 请求出满足条件的最小代价。 注意，每个元素在变换前后都是整数。 Input 第一行为测试的组数T(1≤T≤10). 对于每一组： 第一行为序列A的长度N(1≤N≤105)，第二行包含N个数，A1,A2,...,An. 序列A中的每个元素的值是正整数且不超过106。 Output 对于每一个测试样例，输出两行： 第一行输出："Case #i:"。i代表第 i 组测试数据。 第二行输出一个正整数，代表满足条件的最小代价。 Sample Input 2 2 1 10 3 2 5 4 Sample Output Case #1: 0 Case #2: 1

Istanbul-tools安装错误：github.com/ethereum/go-ethereum/crypto/bn256/cloudflare.gfpMul：重定位目标runtime.support_bmi2未定义

<div class="post-text" itemprop="text"> <p>I am trying to install Istanbul-tools to run an IBFT ethereum network as shown in this tutorial here <a href="https://medium.com/getamis/istanbul-bft-ibft-c2758b7fe6ff" rel="nofollow noreferrer">https://medium.com/getamis/istanbul-bft-ibft-c2758b7fe6ff</a></p> <p>I am installing istanbul-tools via their makefile using</p> <pre><code>go build -v -o ./build/bin/istanbul ./cmd/istanbul </code></pre> <p>After fixing some initial issues, as the code base hasn't been updated in a year, I then received the following error:</p> <pre><code>github.com/ethereum/go-ethereum/crypto/bn256/cloudflare.gfpMul: relocation target runtime.support_bmi2 not defined </code></pre> <p>I also cannot find the Cloudflare file in any location in the go-ethereum folder. Can someone point me in the right direction? Cheers!</p> </div>

<div class="post-text" itemprop="text"> <p>The golang package <a href="https://godoc.org/golang.org/x/crypto/bn256" rel="nofollow noreferrer">bn256</a> can do this: e(g_1^x,g_2^y), but I want to compute e(g_1^x,g_1^y).</p> <p>Is there any way to transfer a point on g1 to g2?</p> </div>

Crazy Bobo

Problem Description Bobo has a tree,whose vertices are conveniently labeled by 1,2,...,n.Each node has a weight wi. All the weights are distrinct. A set with m nodes v1,v2,...,vm is a Bobo Set if: - The subgraph of his tree induced by this set is connected. - After we sort these nodes in set by their weights in ascending order,we get u1,u2,...,um,(that is,wui<wui+1 for i from 1 to m-1).For any node x in the path from ui to ui+1(excluding ui and ui+1),should satisfy wx<wui. Your task is to find the maximum size of Bobo Set in a given tree. Input The input consists of several tests. For each tests: The first line contains a integer n (1≤n≤500000). Then following a line contains n integers w1,w2,...,wn (1≤wi≤109,all the wi is distrinct).Each of the following n-1 lines contain 2 integers ai and bi,denoting an edge between vertices ai and bi (1≤ai,bi≤n). The sum of n is not bigger than 800000. Output For each test output one line contains a integer,denoting the maximum size of Bobo Set. Sample Input 7 3 30 350 100 200 300 400 1 2 2 3 3 4 4 5 5 6 6 7 Sample Output 5

Inversion

Description The inversion number of an integer sequence a1, a2, . . . , an is the number of pairs (ai, aj) that satisfy i < j and ai > aj . Given n and the inversion number m, your task is to find the smallest permutation of the set { 1, 2, . . . , n }, whose inversion number is exactly m. A permutation a1, a2, . . . , an is smaller than b1, b2, . . . , bn if and only if there exists an integer k such that aj = bj for 1 <= j < k but ak < bk. Input The input consists of several test cases. Each line of the input contains two integers n and m. Both of the integers at the last line of the input is −1, which should not be processed. You may assume that 1 <= n <= 50000 and 0 <= m <= n(n − 1)/2. Output For each test case, print a line containing the smallest permutation as described above, separates the numbers by single spaces. Sample Input 5 9 7 3 -1 -1 Sample Output 4 5 3 2 1 1 2 3 4 7 6 5

# 输入要求 先输入一个N，接下来一排有N个整数，N小于20 这N个数在int范围内 ## 输出要求 2个整数。按照输入顺序优先输出 ## 限制要求 只能使用限制头文件所含的内容 ## # **我自己的错误代码示范** （你问我为什么什么都没学也要做，那就教了这个我也没办法啊） ``` #include<stdio.h> int main(){ int N; int n=0; int c,i=0,v=1,d=0,x=1; int r,h=0; int a[19]; int b[19]; int e[19]; while(scanf("%d", &N)!=EOF){// N 总个数 for(i;i<=N-1;i++){ scanf("%d", &a[i]); e[i-1]=a[i]; b[i]=a[i]; }c=1; if(c==1){ for(x;x<=N;x++) { for(n;n<=N-2;n++){ r=a[x] - e[n]; //相同时候r为0 printf("x=%d n=%d r=%d x=%d ax=%d en=%d \n",x,n,r,x,a[x],e[n]); if(r==0){ //相同数字 printf("b=%d\n", b[n]); b[x]=0; } }} } for(h;h<=N-1;h++){ if(b[h]!=0){ printf("bn=%d \n",b[2]);//输出答案 }} // 测试数据14【回车】 12 34 12 34 56 78 67 67 78 98 98 89 89 55 }}//结尾 ```

jsoup抓取dopostback的网页错误 ,是不是BODY出什么问题

Fast Image Match

Given two images A and B, use image B to cover image A. Where would we put B on A, so that the overlapping part of A and B has the most likelihood? To simplify the problem, we assume that A and B only contain numbers between 0 and 255. The difference between A and B is defined as the square sum of the differences of corresponding elements in the overlapped parts of A and B. For example, we have A (3 * 3): a1 a2 a3 B (2 * 2): b1 b2 a4 a5 a6 b4 b5 a7 a8 a9 When B is placed on position a5, the difference of them is ((b1-a5)^2 + (b2-a6)^2 + (b4-a8)^2 + (b5-a9)^2). Now we hope to have the position of the top left corner of B that gives the minimum difference. (B must completely reside on A) It is clear that a simple solution will appear with very low efficiency when A and B have too many elements. But we can use 1-dimensional repeat convolution, which can be computed by Fast Fourier Transform (FFT), to improve the performance. A program with explanation of FFT is given below: /** * Given two sequences {a1, a2, a3.. an} and {b1, b2, b3... bn}, * their repeat convolution means: * r1 = a1*b1 + a2*b2 + a3*b3 + ... + an*bn * r2 = a1*bn + a2*b1 + a3*b2 + ... + an*bn-1 * r3 = a1*bn-1 + a2*bn + a3*b1 + ... + an*bn-2 * ... * rn = a1*b2 + a2*b3 + a3*b4 + ... + an-1*bn + an*b1 * Notice n >= 2 and n must be power of 2. */ #include <vector> #include <complex> #include <cmath> #define for if (0); else for using namespace std; const int MaxFastBits = 16; int **gFFTBitTable = 0; int NumberOfBitsNeeded(int PowerOfTwo) { for (int i = 0;; ++i) { if (PowerOfTwo & (1 << i)) { return i; } } } int ReverseBits(int index, int NumBits) { int ret = 0; for (int i = 0; i < NumBits; ++i, index >>= 1) { ret = (ret << 1) | (index & 1); } return ret; } void InitFFT() { gFFTBitTable = new int *[MaxFastBits]; for (int i = 1, length = 2; i <= MaxFastBits; ++i, length <<= 1) { gFFTBitTable[i - 1] = new int[length]; for (int j = 0; j < length; ++j) { gFFTBitTable[i - 1][j] = ReverseBits(j, i); } } } inline int FastReverseBits(int i, int NumBits) { return NumBits <= MaxFastBits ? gFFTBitTable[NumBits - 1][i] : ReverseBits(i, NumBits); } void FFT(bool InverseTransform, vector<complex<double> >& In, vector<complex<double> >& Out) { if (!gFFTBitTable) { InitFFT(); } // simultaneous data copy and bit-reversal ordering into outputs int NumSamples = In.size(); int NumBits = NumberOfBitsNeeded(NumSamples); for (int i = 0; i < NumSamples; ++i) { Out[FastReverseBits(i, NumBits)] = In[i]; } // the FFT process double angle_numerator = acos(-1.) * (InverseTransform ? -2 : 2); for (int BlockEnd = 1, BlockSize = 2; BlockSize <= NumSamples; BlockSize <<= 1) { double delta_angle = angle_numerator / BlockSize; double sin1 = sin(-delta_angle); double cos1 = cos(-delta_angle); double sin2 = sin(-delta_angle * 2); double cos2 = cos(-delta_angle * 2); for (int i = 0; i < NumSamples; i += BlockSize) { complex<double> a1(cos1, sin1), a2(cos2, sin2); for (int j = i, n = 0; n < BlockEnd; ++j, ++n) { complex<double> a0(2 * cos1 * a1.real() - a2.real(), 2 * cos1 * a1.imag() - a2.imag()); a2 = a1; a1 = a0; complex<double> a = a0 * Out[j + BlockEnd]; Out[j + BlockEnd] = Out[j] - a; Out[j] += a; } } BlockEnd = BlockSize; } // normalize if inverse transform if (InverseTransform) { for (int i = 0; i < NumSamples; ++i) { Out[i] /= NumSamples; } } } vector<double> convolution(vector<double> a, vector<double> b) { int n = a.size(); vector<complex<double> > s(n), d1(n), d2(n), y(n); for (int i = 0; i < n; ++i) { s[i] = complex<double>(a[i], 0); } FFT(false, s, d1); s[0] = complex<double>(b[0], 0); for (int i = 1; i < n; ++i) { s[i] = complex<double>(b[n - i], 0); } FFT(false, s, d2); for (int i = 0; i < n; ++i) { y[i] = d1[i] * d2[i]; } FFT(true, y, s); vector<double> ret(n); for (int i = 0; i < n; ++i) { ret[i] = s[i].real(); } return ret; } int main() { double a[4] = {1, 2, 3, 4}, b[4] = {1, 2, 3, 4}; vector<double> r = convolution(vector<double>(a, a + 4), vector<double>(b, b + 4)); // r[0] = 30 (1*1 + 2*2 + 3*3 + 4*4) // r[1] = 24 (1*4 + 2*1 + 3*2 + 4*3) // r[2] = 22 (1*3 + 2*4 + 3*1 + 4*2) // r[3] = 24 (1*2 + 2*3 + 3*4 + 4*1) return 0; } Input The first line contains n (1 <= n <= 10), the number of test cases. For each test case, the first line contains four integers m, n, p and q, where A is a matrix of m * n, B is a matrix of p * q (2 <= m, n, p, q <= 500, m >= p, n >= q). The following m lines are the elements of A and p lines are the elements of B. Output For each case, print the position that gives the minimum difference (the top left corner of A is (1, 1)). You can assume that each test case has a unique solution. Sample Input 2 2 2 2 2 1 2 3 4 2 3 1 4 3 3 2 2 0 5 5 0 5 5 0 0 0 5 5 5 5 Sample Output 1 1 1 2

Problem Description A sequence b1,b2,⋯,bn are called (d1,d2)-arithmetic sequence if and only if there exist i(1≤i≤n) such that for every j(1≤j<i),bj+1=bj+d1 and for every j(i≤j<n),bj+1=bj+d2. Teacher Mai has a sequence a1,a2,⋯,an. He wants to know how many intervals [l,r](1≤l≤r≤n) there are that al,al+1,⋯,ar are (d1,d2)-arithmetic sequence. Input There are multiple test cases. For each test case, the first line contains three numbers n,d1,d2(1≤n≤105,|d1|,|d2|≤1000), the next line contains n integers a1,a2,⋯,an(|ai|≤109). Output For each test case, print the answer. Sample Input 5 2 -2 0 2 0 -2 0 5 2 3 2 3 3 3 3 Sample Output 12 5

Problem Description PM Room defines a sequence A = {A1, A2,..., AN}, each of which is either 0 or 1. In order to beat him, programmer Moor has to construct another sequence B = {B1, B2,... , BN} of the same length, which satisfies that: Input The input consists of multiple test cases. The number of test cases T(T<=100) occurs in the first line of input. For each test case: The first line contains a single integer N (1<=N<=100000), which denotes the length of A and B. The second line consists of N integers, where the ith denotes Ai. Output Output the minimal f (A, B) when B is optimal and round it to 6 decimals. Sample Input 4 9 1 1 1 1 1 0 0 1 1 9 1 1 0 0 1 1 1 1 1 4 0 0 1 1 4 0 1 1 1 Sample Output 1.428571 1.000000 0.000000 0.000000

Problem Description 在数学中，我们经常会遇到，关于函数的问题，在画一些函数的图像的时候，最长用的方法就是“描点法”。 “描点法” 的具体步骤如下： > 计算出函数在某些特定点的值 > 在坐标系中标记出这些点 > 用平滑的曲线连接这些点 但是，在实际的操作中，我们会发现，前两部的计算量还是相当大的，所以，我们想编写一个程序，能够在一个坐标系中直接的画出各点。 为了简化这个问题，给出如下y 关于x 的函数表达式 y=a1x^b1+a2x^b2+a3x^b3+...+anx^bn 表达式不超过5项，并且 其中每项的系数 -10 < a <10 ， x的指数 0 <= b < 5 表达式中，所有的字符串都是以 ”y=” 开始的 ，在之后的字符串中只含有x ，+ ， - ， 0~9 这些字符，不含有空格。无非法表达式输入。 特别的： 当x 的指数为1时，省略指数, 例如: y = 2x^1 应表示为 y = 2x 当x 的指数为0时，省略指数和x, 例如: y = 3x^3+2x^0 应表示为 y = 3x^3+2 当x 的系数为负时, 例如: y = 3x^2 + (-1) x 应表示为 y = 3x^2 – x , y = 2x + (-2) 应表示为 y = 2x - 2 在如下坐标系中画出，x属于[-30,30] 所对应y属于[-30,30]的图像。 Input 多组数据输入，每组数据的第一行给出一个n (1<=n <= 26) ，接下来的n行，每行有一个函数的表达式。 Output 对于每组输入数据，在第一行输出，”Case:#” ，# 代表当前的组号。 画出该函数的图像 x取值[-30,30]时， y在 [-30,30]内的点 。对于给出的n个表达式，依次用字母a-z表示每个函数图像上的的所有点。两个图像的交点 或者 图像与坐标轴的交点 用 ‘.’ 表示。输出格式如下所示。各组之间无空行。 Sample Input 2 y=-x-1 y=x^4+1-x^3 Sample Output Case:1 y^ | a | a | a | a | a b | a | a | a | a | a | a | a | a | a | a | a | a | a | a | a | a | b a | a | a | a | a | a b| a | a .b -----------------------------.+------------------------------> . x |a | a | a | a | a | a | a | a | a | a | a | a | a | a | a | a | a | a | a | a | a | a | a | a | a | a | a | a | a

Problem Description Let { A1,A2,...,An } be a permutation of the set{ 1,2,..., n}. If i < j and Ai > Aj then the pair (Ai,Aj) is called an "inversion" of the permutation. For example, the permutation {3, 1, 4, 2} has three inversions: (3,1), (3,2) and (4,2). The inversion table B1,B2,...,Bn of the permutation { A1,A2,...,An } is obtained by letting Bj be the number of elements to the left of j that are greater than j. (In other words, Bj is the number of inversions whose second component is j.) For example, the permutation: { 5,9,1,8,2,6,4,7,3 } has the inversion table 2 3 6 4 0 2 2 1 0 since there are 2 numbers, 5 and 9, to the left of 1; 3 numbers, 5, 9 and 8, to the left of 2; etc. Perhaps the most important fact about inversions is Marshall Hall's observation that an inversion table uniquely determines the corresponding permutation. So your task is to convert a permutation to its inversion table, or vise versa, to convert from an inversion table to the corresponding permutation. Input The input consists of several test cases. Each test case contains two lines. The first line contains a single integer N ( 1 <= N <= 50) which indicates the number of elements in the permutation/invertion table. The second line begins with a single charactor either 'P', meaning that the next N integers form a permutation, or 'I', meaning that the next N integers form an inversion table. Output For each case of the input output a line of intergers, seperated by a single space (no space at the end of the line). If the input is a permutation, your output will be the corresponding inversion table; if the input is an inversion table, your output will be the corresponding permutation. Sample Input 9 P 5 9 1 8 2 6 4 7 3 9 I 2 3 6 4 0 2 2 1 0 0 Sample Output 2 3 6 4 0 2 2 1 0 5 9 1 8 2 6 4 7 3

Problem Description people in USSS love math very much, and there is a famous math problem . give you two integers n,a,you are required to find 2 integers b,c such that an+bn=cn. Input one line contains one integer T;(1≤T≤1000000) next T lines contains two integers n,a;(0≤n≤1000,000,000,3≤a≤40000) Output print two integers b,c if b,c exits;(1≤b,c≤1000,000,000); else print two integers -1 -1 instead. Sample Input 1 2 3 Sample Output 4 5

A poor officer 进行求解

Problem Description There are n soldiers numbered from 1 to n in a troop. They stand in a line according to their numbers, which means the soldier numbered i stands at the ith position. But the officer of this troop is unsatisfied with the arrangement, he decides to rearrange it. After a careful consideration, the officer develops such rearrangement as follows: He thinks up a permutation of 1 to n, and then commands the aith soldier to stand in the ith position in the new arrangement. However, the new sequence still cannot meet the officer’s need. So they have to apply the arrangement repeatedly according to the method the officer thinks up. For example, there are 5 soldiers in the troop; the permutation in the officer’s mind is 2 1 4 5 3. After the first rearrangement, the troop sequence is 2 1 4 5 3. After the second rearrangement, the sequence becomes 1 2 5 3 4. Unluckily, after a long time of rearrangements, the officer and the soldiers are very tired but the strict officer is still unsatisfied. The poor officer asks the soldiers, “Who can tell me the least times of rearrangements needed to reach the arrangement I like.” As the smartest soldier you decide to answer the officer’s question. Here is an example: if there are 5 soldiers in the troop, the permutation in the officer’s mind is 2 1 4 5 3. He wants the troop to be 2 1 3 4 5. The rearrangements are as follows: Input The input contains several cases. Each case is described as follows: 1st line: n, the number of soldiers (0 < n ≤ 10,000). 2nd line: a1 a2 ... an, the permutation that the troop applies each time. 3rd line: b1 b2 ... bn, the target arrangement the officer is satisfied with. The last case is followed by a line containing one zero. Output For each case, output one line which contains the least times needed. You may assume it’s less than 2,000,000,000. If it’s impossible to do that, just output -1. Sample Input 5 2 1 4 5 3 2 1 3 4 5 0 Sample Output 3

Calculate the Integral

Define the following functions: Given integer N (1 <= n <= 100) and {an} {bn}, for 1 <= i <= N, define: and calculate the integral: Input A line containing only the integer N is given first. Then N lines follow, each line has two float-point number Ai and Bi. There are several test cases, so process to the end of file. Output For each testcase, output a line containing only the integer N first. Then output a second line containing the result of the integral. The result should be printed in scientific format which has a precision of 10 digits after radix point. Sample Input 1 0 2 2 1 3 0 4 3 2 4 1 5 0 6 Sample Output 1 0.0000000000e+000 2 8.0000000000e+000 3 7.2000000000e+001

Java基础知识面试题（2020最新版）

Intellij IDEA 实用插件安利

1. 前言从2020 年 JVM 生态报告解读 可以看出Intellij IDEA 目前已经稳坐 Java IDE 头把交椅。而且统计得出付费用户已经超过了八成（国外统计）。IDEA 的...

MySQL数据库面试题（2020最新版）

2020阿里全球数学大赛：3万名高手、4道题、2天2夜未交卷

HashMap底层实现原理，红黑树，B+树，B树的结构原理 Spring的AOP和IOC是什么？它们常见的使用场景有哪些？Spring事务，事务的属性，传播行为，数据库隔离级别 Spring和SpringMVC，MyBatis以及SpringBoot的注解分别有哪些？SpringMVC的工作原理，SpringBoot框架的优点，MyBatis框架的优点 SpringCould组件有哪些，他们...

Python爬虫，高清美图我全都要（彼岸桌面壁纸）

Vue回炉重造之router路由（更新中）

Java岗开发3年，公司临时抽查算法，离职后这几题我记一辈子