摘要:
题意:给a b 求 a 范围内最大的 x * y / gcd(x, y) = b; 解题思路:一开始想的是枚举lcm的倍数到a * a, 然后在倍数里枚举因子判断是否合法 直接枚举因子就可以了, 因子范围小 只用n方 枚举lcm的每个倍数都是n方 以后做题尽量枚举小范围易得的部分 代码: /* Ze 阅读全文
摘要:
题意: 给一序列串求最大x 有 x前删除一个值后每个值出现次数相同 解法: B1是小范围版, 只要枚举数字就行 B2用权值线段树记录最大最小出现次数, 出现n次的数有几个, 结合B1的规律(在代码里↓)写即可 代码 /* Zeolim - An AC a day keeps the bug away 阅读全文
摘要:
You are given a tree (an undirected connected acyclic graph) consisting of nn vertices and n−1n−1 edges. A number is written on each edge, each number 阅读全文
摘要:
There are nn people in a row. The height of the ii-th person is aiai. You can choose any subset of these people and try to arrange them into a balance 阅读全文
摘要:
Polycarp has to solve exactly nn problems to improve his programming skill before an important programming competition. But this competition will be h 阅读全文