随笔分类 - ACM---矩阵
摘要:考虑一个经典的问题: 询问从某个点出发,走 k 步到达其它各点的方案数? 这个问题可以转化为矩阵相乘,所以矩阵快速幂即可解决。 本题思路: 矩阵经典问题:求从i点走k步后到达j点的方案数(mod p)。 本题输出X/Y,可以看成X是u走k步到j的方案数,Y是从u走k步的所有方案数 于是对矩阵先进行处
阅读全文
摘要:Problem Description北京迎来了第一个奥运会,我们的欢呼声响彻中国大地,所以今年的奥运金牌 day day up!比尔盖兹坐上鸟巢里,手里摇着小纸扇,看的不亦乐乎,被俺们健儿的顽强拼搏的精神深深的感动了。反正我的钱也多的没地方放了,他对自己说,我自己也来举办一个奥运会,看谁的更火。不...
阅读全文
摘要:Problem DescriptionLele now is thinking about a simple function f(x).If x = 10 f(x) = a0 * f(x-1) + a1 * f(x-2) + a2 * f(x-3) + …… + a9 * f(x-10);And ...
阅读全文
摘要:Problem DescriptionA为一个方阵,则Tr A表示A的迹(就是主对角线上各项的和),现要求Tr(A^k)%9973。Input数据的第一行是一个T,表示有T组数据。每组数据的第一行有n(2 2 #include 3 #include 4 using namespace std; 5...
阅读全文
摘要:Problem DescriptionAn Arc of Dream is a curve defined by following function:wherea0 = A0ai = ai-1*AX+AYb0 = B0bi = bi-1*BX+BYWhat is the value of AoD(...
阅读全文
摘要:Problem DescriptionDefine f(n) as the number of ways to perform n in format of the sum of some positive integers. For instance, when n=4, we have 4=1...
阅读全文
摘要:Problem DescriptionQueues and Priority Queues are data structures which are known to most computer scientists. The Queue occurs often in our daily lif...
阅读全文
摘要:Problem DescriptionThere are N cities in the country. Each city is represent by a matrix size of M*M. If city A, B and C satisfy that A*B = C, we say ...
阅读全文
摘要:DescriptionYYF is a couragous scout. Now he is on a dangerous mission which is to penetrate into the enemy's base. After overcoming a series difficult...
阅读全文