How rival bots battled their way to poker supremacy http://www.nature.com/news/how-rival-bots-battled-their-way-to-poker-supremacy-1.21580 Artificial-intelligence programs harness game-theory strategies and deep learning to defeat human professionals…
RPCL是在线kmeans的改进版,相当于半自动的选取出k个簇心:一开始设定N个簇心,N>k,然后聚类.每次迭代中把第二近的簇心甩开一段距离. 所谓在线kmeans是就是,每次仅仅用一个样本来更新簇心位置,而不是用全部数据("批量"). 代码: % RPCL, rival penalized competitive learning,改进版的Kmeans % 根据http://www.cs.hmc.edu/~asampson/ap/ap.git移植而来,并根据RPCL原文进行了修…
H. Bots time limit per test 1.5 seconds memory limit per test 256 megabytes input standard input output standard output Sasha and Ira are two best friends. But they aren’t just friends, they are software engineers and experts in artificial intelligen…
H. Bots Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/575/problem/H Description Sasha and Ira are two best friends. But they aren’t just friends, they are software engineers and experts in artificial intelligence. They are…
题意: 简单来说就是生成一棵树,要求根到每个叶子节点上的路径颜色排列不同, 且每条根到叶子的路径恰有n条蓝边和n条红边. 求生成的树的节点个数. 1<=n<=10^6 题解: 简单计数. 显然,前n层的边的颜色是任意的,所以第i层就是2^i个点. 对于后n层,可以直接由上一层转移. 因为已经知道上一层合法的个数,那么如果现在每个点扩展两条边, 那么上一层的状态中,某种颜色的个数已经达到n的情况就有一条边不可扩展, 所以要减去2*C(i-1,n). 1 2 3 4 5 6 7 8 9 10 11…
转自:廖雪峰网站 1.map/reduce map()函数接收两个参数,一个是函数,一个是Iterable,map将传入的函数依次作用到序列的每个元素,并把结果作为新的Iterator返回. 举例说明,比如我们有一个函数f(x)=x2,要把这个函数作用在一个list [1, 2, 3, 4, 5, 6, 7, 8, 9]上,就可以用map()实现如下: >>> def f(x): ... return x * x ... >>> r = map(f, [1, 2, 3,…
题目:两个竞争的学生 链接:(两个竞争的对手)[https://codeforces.com/contest/1257/problem/A] 题意:有n个学生排成一行.其中有两个竞争的学生.第一个学生在位置a,第二个学生在位置b,位置从左往右从1到n编号. 你的目的是在经过x次交换后,他们之间的距离最大.(每次交换都是交换相邻的两个学生) 分析: 1.答案是不可能大于n - 1的 2.两者之间的距离可以通过交换增加x,只要答案小于n - 1 因此,取两者最小值就是答案 #include <cst…
题意:给你n个人和两个尖子生a,b,你可以操作k次,每次操作交换相邻两个人的位置,求问操作k次以内使得ab两人距离最远是多少 题解:贪心尽可能的将两人往两边移动,总结一下就是min(n-1,|a-b|+x) 代码: #include<iostream> #include<cstdio> #include<cstdlib> using namespace std; int T; int n,m,a,b; int main() { scanf("%d",…
You are the gym teacher in the school. There are nn students in the row. And there are two rivalling students among them. The first one is in position aa, the second in position bb. Positions are numbered from 11 to nn from left to right. Since they…