随笔分类 -  线段树&树状数组

摘要:number⋅x+product⋅y=1 有整数x,y解的条件是gcd(number, product) == 1. product用线段树维护一下,然后现学了个欧拉函数。 可以这样假如x = p1^a1 * p2^a2 * p3^a3 * ... * pn^an,那么phi(x) = (p... 阅读全文
posted @ 2015-12-29 02:40 y7070 阅读(359) 评论(0) 推荐(0)
摘要:模板题,折腾了许久。 cqd分治整体二分,感觉像是把询问分到答案上。 1 #include 2 #define rep(i, a, b) for (int i = a; i = b; i--) 4 #define REP(i, a, b) for (int i = a; i pii;... 阅读全文
posted @ 2015-12-23 12:40 y7070 阅读(749) 评论(0) 推荐(0)
摘要:首先一定要看到x + y + z = N这个条件,没看到就世界再见了。 赢的人得分需要大于等于2,那么无非就是 (x, y), (x, z), (y, z), (x, y, z) 大于其他的点。但是考虑一下(x, y, z)均大于是不可能的,因为 x + y + z = N。(x, y) 和 ... 阅读全文
posted @ 2015-12-04 13:05 y7070 阅读(198) 评论(0) 推荐(0)
摘要:Mayor's postersTime Limit:1000MSMemory Limit:65536KTotal Submissions:50888Accepted:14737DescriptionThe citizens of Bytetown, AB, could not stand that ... 阅读全文
posted @ 2015-08-24 17:11 y7070 阅读(217) 评论(0) 推荐(0)
摘要:Who Gets the Most Candies?Time Limit:5000MSMemory Limit:131072KTotal Submissions:11955Accepted:3734Case Time Limit:2000MSDescriptionNchildren are sitt... 阅读全文
posted @ 2015-08-22 16:39 y7070 阅读(367) 评论(0) 推荐(0)