0%

Description On the Literature lesson Sergei noticed an awful injustice, it seems that some students are asked more often than others. Seating in the class looks like a rectangle, where n rows with m pupils in each. The teacher asks pupils in the following order: at first, she ask...

Description You are the manager of a small soccer team. After seeing the shameless behavior of your team during the match, you are mad at all of the current players. Therefore, you have made a huge decision: put these players on the substitution bench, and buy the entire starting...

http://codeforces.com/contest/794/problem/C Description Oleg the client and Igor the analyst are good friends. However, sometimes they argue over little things. Recently, they started a new company, but they are having trouble finding a name for the company. To settle this proble...

其实是大一还不会GUI时闲着无聊写的。都是硬编码,也不支持自定义棋盘大小,现在看看这代码惨不忍睹。下载地址:http://download.csdn.net/download/xienaoban/9835259 #实现 输入P x y 模拟插下小旗,输入I x y 模拟点下去,输入O x y 模拟探测,输入R重玩。 原理嘛就是开局生成8个雷,并将所有点周围的雷计算好填入棋盘。当输入Ixy点下去时若该点为0,则显示该点并DFS递归遍历周围所有点并显示;若为非零,则直接显示它;若为雷则输了。 唯一与别人不同的特性是,输入本人的名字首字母xjf(必须小写)可以...

学校组织的计算机技能大赛,题目解八皇后并做程序演示,顺便就贴博客上来。 八皇后问题 简述:8*8的棋盘,有八个皇后,每个皇后不能在同一行同一列同一斜线上,问有多少种可能的摆法。答案是92,这大家都知道。 #解法与优化 首先肯定是遍历嘛,关键是要剪枝。 ##1.暴力枚举 8个子所有点遍历一遍,8个嵌套for,一共\(C_{64}^{8}\)种情况。曰曰 ##2.回溯法 由于每个皇后不能在一行,那八个皇后就在八个不同行上面嘛,对于每个皇后/每一行,采用回溯法先第一行放一个,在第二行剩下7个位置中找第二个皇后可能的位置,以此类推,一共\(8^8 = 16777...

https://code.google.com/codejam/contest/3274486/dashboard #Problem The kitchen at the Infinite House of Pancakes has just received an order for a stack of K pancakes! The chef currently has N pancakes available, where N ≥ K. Each pancake is a cylinder, and different pancakes may ...

卷积 给定向量:\(a=(a_0,a_1,...,a_{n-1})\),\(b=(b_0,b_1,...,b_{n-1})\) 向量和:\(a+b=(a_0+b_0,a_1+b_1,...,a_{n-1}+b_{n-1})\) 数量积(内积、点积):\(a·b=a_0b_0+a_1b_1+...+a_{n-1}b_{n-1}\) 卷积:\(a \otimes b=(c_0,c_1,...,c_{2n-2})\),其中\(c_k=\sum_{i+j=k}(a_ib_j)\) 例如:\(c_{n-1}=a_0b_{n-1}+a_1b_{n-2}+...+a_...

http://codeforces.com/problemset/problem/786/A #Description Rick and Morty are playing their own version of Berzerk (which has nothing in common with the famous Berzerk game). This game needs a huge space, so they play it with a computer. In this game there are n objects numbered...

#Description 一个数组,要求先对前n个数字排序(以方便后续操作);又要求对前n+i个数字排序;又要求对前n+j ... 前n+k个数字排序(i、j、k的大小远小于n,且i、j、k间没有大小关系)。总之就是对一个不定的范围内数据要进行频繁的按大小顺序调用,但是这个范围边界变化不大,很多数据重叠,这样每次都对此次区间内数据排序,频繁排序的话很费时间。 例如一个数组\(\{1,3,6,5,2,4,1,9,0\}\),一共9个数字,下标08。要求: 每次取一个区间,计算区间内\((最大值-最小值)^2+(次大值-次小值)^2+(次次大值-次次小值)^...

#Description There are n cities in Berland, each of them has a unique id — an integer from 1 to n, the capital is the one with id 1. Now there is a serious problem in Berland with roads — there are no roads. That is why there was a decision to build n - 1 roads so that there will...

#Description As you probably know, Anton goes to school. One of the school subjects that Anton studies is Bracketology. On the Bracketology lessons students usually learn different sequences that consist of round brackets (characters "(" and ")" (without quotes)). On the last les...

欠拟合(Underfitting)与过拟合(Overfitting) 上面两张图分别是回归问题和分类问题的欠拟合和过度拟合的例子。可以看到,如果使用直线(两组图的第一张)来拟合训,并不能很好地适应我们的训练集,这就叫欠拟合(Underfitting),但是如果x的次数太高(两组图的第三张),拟合虽然很好,但是预测能力反而变差了,这就是过拟合(Overfitting)。 对于欠拟合,我们可以适当增加特征,比如加入x的多次方。通常这很少发生,发生的多的都是过拟合。那么如何处理过度拟合呢? 1. 丢弃一些不能帮助我们正确预测的特征。可以是手工选择保留哪些特征,...

逻辑回归算法是分类算法,虽然这个算法的名字中出现了“回归”,但逻辑回归算法实际上是一种分类算法,我们将它作为分类算法使用。。 分类问题:对于每个样本,判断它属于N个类中的那个类或哪几个类。通常我们判定一个样本,若我们预测它的确属于这个类的可能性大于50%,则认为它属于这个类。当然具体选择50%还是70%还是其他要看具体情况,这里先默认50%。 线性回归的局限性在分类问题的例子中变得不可靠:这是一个用来预测肿瘤是否呈阴性的模型,当一个肿瘤的尺寸大于一个数,我们就认为这个肿瘤呈阴性。我们现在新增了一个数据,结果导致整个模型的参数变化很大。如下图,在新加入最右...

线性回归属于回归问题。对于回归问题,解决流程为: 给定数据集中每个样本及其正确答案,选择一个模型函数h(hypothesis,假设),并为h找到适应数据的(未必是全局)最优解,即找出最优解下的h的参数。这里给定的数据集取名叫训练集(Training Set)。不能所有数据都拿来训练,要留一部分验证模型好不好使,这点以后说。先列举几个几个典型的模型: 最基本的单变量线性回归: 形如h(x)=theta0+theta1*x1 多变量线性回归: 形如h(x)=theta0+theta1x1+theta2x2+theta3*x3 多项式回归(Polynomial...

目录会根据我的学习进度而更新,给自己列一个大纲以系统地看待整个学习过程。 #学习资料来源 学习的是Coursera上吴恩达(Andrew Ng)老师的机器学习视频(课程传送门,最近在“最强大脑”上看到他了好激动啊,原来他去做百度大脑了呀),笔记根据此系列视频整理。笔记顺序不一定与原教程一样,希望加入些自己的思考。 同时使用了网上找到的黄海广博士的对于吴大大视频教程的笔记(传送门)。因为我一开始看视频没做笔记,现在忘得差不多啦,现在打算写个笔记,重新去看视频再整理太麻烦,网上竟然找到这一神器,视频内容全都用中文写在里面了,棒!(不过还是不太好意思发邮件给他...