03 2017 档案
摘要:int add(long long &x,long long y) { x+=y; x%=MOD; } Matrix mutil(Matrix x,Matrix y) { Matrix z; memset(z.a,0,sizeof(z.a)); for(int i=0;i<X;i++) { for(int k=0;k<X;k++) ...
阅读全文
摘要:There are b blocks of digits. Each one consisting of the same n digits, which are given to you in the input. Wet Shark must choose exactly one digit f
阅读全文
摘要:Vasya and Petya wrote down all integers from 1 to n to play the "powers" game (n can be quite large; however, Vasya and Petya are not confused by this
阅读全文
摘要:As you probably know, Anton goes to school. One of the school subjects that Anton studies is Bracketology. On the Bracketology lessons students usuall
阅读全文
摘要:威佐夫博弈: 这个博弈主要的结论就是用到了黄金分割。 有两堆石子,数量任意,可以不同。游戏开始由两个人轮流取石子。游戏规定,每次有两种不同的取法,一是可以在任意的一堆中取走任意多的石子;二是可以在两堆中同时取走相同数量的石子。最后把石子全部取完者为胜者。现在给出初始的两堆石子的数目,如果轮到你先取,
阅读全文
摘要:In a far away galaxy there is war again. The treacherous Republic made k precision strikes of power ai on the Empire possessions. To cope with the rep
阅读全文
摘要:Bike is interested in permutations. A permutation of length n is an integer sequence such that each integer from 0 to (n - 1) appears exactly once in
阅读全文
摘要:Problem Description The TV shows such as You Are the One has been very popular. In order to meet the need of boys who are still single, TJUT hold the
阅读全文
摘要:Police headquarter is monitoring signal on different frequency levels. They have got two suspiciously encoded strings s1 and s2 from two different fre
阅读全文
摘要:质数筛法: 肯定有一个质因数是小于根号n的。这个东西是很明显的。 启发式分解: review :欧几里得算法的证明 a=bmodc ==> a-k*c=b; 扩展欧几里得求得解为 |s|+|t|最小的解 分数工厂: 有 n 个正整数 a1, a2, · · · , an 和 m 个正整数 b1, b
阅读全文
摘要:Imagine A is a NxM matrix with two basic properties 1) Each element in the matrix is distinct and lies in the range of 1<=A[i][j]<=(N*M) 2) For any tw
阅读全文
摘要:我感觉二维树状数组和而为线段树的思想差不多,都是在原来的基础上加了一个新的树状数组或者是线段树,代码量也不是那么的大。 然后我想找一个图的,但是在百度上面也没有找到什么好点的图,因为一维树状数组解决的是一个区间的和,那么我们每个数下面再加上一个树状数组, 那么我们解决的就是一个矩形区域的所有的数的和
阅读全文
摘要:Problem Description There are n men ,every man has an ID(1..n).their ID is unique. Whose ID is i and i-1 are friends, Whose ID is i and i+1 are friend
阅读全文
摘要:Innokenty is a president of a new football league in Byteland. The first task he should do is to assign short names to all clubs to be shown on TV nex
阅读全文
摘要:1100 - 萌萌哒的第五题 Time Limit:10s Memory Limit:128MByte Submissions:353Solved:76 1100 - 萌萌哒的第五题 Time Limit:10s Memory Limit:128MByte Submissions:353Solved
阅读全文
摘要:这个问题就是简单的Lucas定理的基础的问题,但是还是应该自己写一下的。 因为FZU现在不能提交所以说我也不知道对不对,但是感觉应该是对的。 DP? Time Limit: 10000/3000 MS (Java/Others) Memory Limit: 128000/128000 K (Java
阅读全文
摘要:LL quick_mod(LL a, LL b) { LL ans = 1; a %= p; while(b) { if(b & 1) { ans = ans * a % p; b--; } b >>= 1; ...
阅读全文
摘要:n个人,每个人ci的金币,每天最富有的人都会给最贫穷的人1金币,问k天后最富有人和最贫穷的人差了多少金币。 数据 1 <= n <= 5e5, 0 <= k <= 1e9, 1 <= ci <= 1e9。 输入 4 1 1 1 4 2 3 1 2 2 2 输出 2 0 说明 对于样例1, [1,1,
阅读全文
摘要:第一次感觉vector有很多的用法,我们可以在vector里面进行删除和修改操作,复杂度都是log(n)还有就是lower_bound()和upper_bound() 加上这些的东西,感觉stl解决的问题就是更多了。 lower_bound(): 在first和last的前闭后开区间进行二分查找,返
阅读全文