D. Longest Subsequence 题目连接: http://www.codeforces.com/contest/632/problem/D Description You are given array a with n elements and the number m. Consider some subsequence of a and the value of least common multiple (LCM) of its elements. Denote LCM a…
题目链接: Dertouzos Time Limit: 7000/3500 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others) Problem Description A positive proper divisor is a positive divisor of a number n, excluding n itself. For example, 1, 2, and 3 are positive proper…
FSF’s game Problem Description FSF has programmed a game.In this game, players need to divide a rectangle into several same squares.The length and width of rectangles are integer, and of course the side length of squares are integer. After division,…
A =w= B 占坑 C 题意:有长度为n的序列A和长度为n的序列W,以及一个G,对于Ui,1<=Ui<=Wi,求Σgcd(Ai,Ui)=G的方案数,n<=1e3,Ai<=1e5,Wi<=1e5,G<=1e3 分析:递推 f(i,j)表示前i位,当前和为j的方案数 f(i,j)=Σf(i-1,j-gcd(Ai,k)) 这样直接搞是会TLE 注意到我们如果对于一个Ai能预处理求出gcd(Ai,k)的所有种类和个数,那么时间就允许了 考虑Ai.Wi,首先筛出Ai的所有因子,…