POJ 3617 – Best Cow Line [贪心+枚举]

Link 传送门 Problem FJ is about to take his N (1 ≤ N ≤ 2,000) cows to the annual”Farmer of the Year” competition. In this contest every farmer arranges his cows in a line and herds them past the judges. The contest organizers adopted a...

POJ 3617 – Best Cow Line [贪心+枚举]

Link 传送门 Problem FJ is about to take his N (1 ≤ N ≤ 2,000) cows to the annual”Farmer of the Year” competition. In this contest every...

HDU 5642 – King’s Order [数位DP]

Link 传送门 Problem After the king’s speech , everyone is encouraged. But the war is not over. The king needs to give orders from time to time. But sometimes he can not speak things well. So in his order there are some ones like this: “...

HDU 5642 – King’s Order [数位DP]

Link 传送门 Problem After the king’s speech , everyone is encouraged. But the war is not over. The king needs to give orders from time to tim...

CodeForces 651D – Watchmen [二分]

Link 传送门 Problem Vasya’s telephone contains n photos. Photo number 1 is currently opened on the phone. It is allowed to move left and right to the adjacent photo by swiping finger over the screen. If you swipe left from the first photo, y...

CodeForces 651D – Watchmen [二分]

Link 传送门 Problem Vasya’s telephone contains n photos. Photo number 1 is currently opened on the phone. It is allowed to move left and righ...

LightOJ 1336 – Sigma Function [规律+打表/推公式]

Link 点击打开题目链接 Problem Sigma function is an interesting function in Number Theory. It is denoted by the Greek letter Sigma (σ). This function actually denotes the sum of all divisors of a number. For example σ(24) = 1+2+3+4+6+8+12+24=60. Si...

LightOJ 1336 – Sigma Function [规律+打表/推公式]

Link 点击打开题目链接 Problem Sigma function is an interesting function in Number Theory. It is denoted by the Greek letter Sigma (σ). This functio...

HDU 4455 – Substrings [计数+递推]

Link 点击打开hdu题目链接 Mean 给定一个长为n的数组,数组中的数大于0小于10^6。询问q次,询问长度为w的子数组(连续的)的权值和,子数组的权值为其数组中的不同元素的个数. Analyse 计数+递推的好题，这道题很容易往线段树或者树状数组方面想，但都会超时。正解是预处...

HDU 4455 – Substrings [计数+递推]

Link 点击打开hdu题目链接 Mean 给定一个长为n的数组,数组中的数大于0小于10^6。询问q次,询问长度为w的子数组(连续的)的权值和,子数组的权值为其数组中的不同...