function [ y ] = moving_average( x, win_size ) y1=filter(ones(1,win_size/2+1)/win_size,1,x); y2=filter(ones(1,win_size/2+1)/win_size,1,fliplr(x)); y=y1+fliplr(y2)-(1/win_size)*x; end L = win_size/2; yi = (1/win_size)∑(j=i-L:i+L)xj 本系列文章允许转载,转载请保留全文
一.题目 A lattice point (x, y) in the first quadrant (x and y are integers greater than or equal to 0), other than the origin, is visible from the origin if the line from (0, 0) to (x, y) does not pass through any other lattice point. For example, the p
一.题目 The Farey Sequence Fn for any integer n with n >= 2 is the set of irreducible rational numbers a/b with 0 < a < b <= n and gcd(a,b) = 1 arranged in increasing order. The first few are F2 = {1/2} F3 = {1/3, 1/2, 2/3} F4 = {1/4, 1/3, 1/2, 2
Problem H. Cups and Beans 2017.8.11 原题: There are N cups numbered 0 through N − 1. For each i(1 ≤ i ≤ N − 1), the cup i contains Ai beans,and this cup is labeled with an integer Ci.Two people will play the following game:• In each turn, the player ch
原题链接:http://poj.org/problem?id=1664 思路:苹果m个,盘子n个.假设 f ( m , n ) 代表 m 个苹果,n个盘子有 f ( m , n ) 种放法. 根据 n 和 m 的关系可以进一步分析: 特殊的 n = 1 || m = 1 || n = 0 时只有一种方法 当 m < n时,即使苹果每个盘子放一个也没法放满所有盘子,题目允许有的盘子空着不放,所以我们可以将空盘子去掉,即 f ( m , n ) = f ( m , m ) 当 m >= n时,这时
矩阵乘法,顾名思义矩阵与矩阵相乘, 两矩阵可相乘的前提:第一个矩阵的行与第二个矩阵的列相等 相乘原则: a b * A B = a*A+b*C a*c+b*D c d C D = c*A+d*C c*A+d*C 上代码 struct matrix { ll a[maxn][maxn]; }; matrix matrix_mul(matrix x,matrix y) { matrix temp; ;i<=n;i++) ;j<=n;j++) { tem