UESTC 491 – Tricks in Bits [二进制+DFS]


Link http://acm.uestc.edu.cn/#/problem/show/491 Mean 给N个整数,可以将其中几个数取反,然后在N个数两两之间插入“与或非”之一,求最终表达式的最小值。 Analysis 两个数“与”之后,1的数目一定小于原来的一半,如果不是,将数取反即可。 由于是64位整数,所以6次“...

UESTC 491 – Tricks in Bits [二进制+DFS]

Link http://acm.uestc.edu.cn/#/problem/show/491 Mean 给N个整数,可以将其中几个数取反,然后在N个数两两之间插入“与或非”之一,求最终表达式的最小值。 A...
阅读全文 0

HDU 1242/ZOJ 1649 – Rescue [最短路]


Link http://acm.hdu.edu.cn/showproblem.php?pid=1242 http://www.icpc.moe/onlinejudge/showProblem.do?problemCode=1649 Problem Angel was caught by the MOLIGPY! He was put in prison by Moligpy. The prison is described as a N * M (N, M <= 200) matri...

HDU 1242/ZOJ 1649 – Rescue [最短路]

Link http://acm.hdu.edu.cn/showproblem.php?pid=1242 http://www.icpc.moe/onlinejudge/showProblem.do?problemCode=1649 Problem Angel was caught by the...
阅读全文 0

HDU 3085 – Nightmare Ⅱ [双向BFS]


Link http://acm.hdu.edu.cn/showproblem.php?pid=3085 Problem Last night, little erriyue had a horrible nightmare. He dreamed that he and his girl friend were trapped in a big maze separately. More terribly, there are two ghosts in the maze. They wi...

HDU 3085 – Nightmare Ⅱ [双向BFS]

Link http://acm.hdu.edu.cn/showproblem.php?pid=3085 Problem Last night, little erriyue had a horrible nightmare. He dreamed that he and his girl fr...
阅读全文 0

HDU 4336 – Card Collector [状压概率DP]


Link http://acm.hdu.edu.cn/showproblem.php?pid=4336 Problem In your childhood, do you crazy for collecting the beautiful cards in the snacks? They said that, for example, if you collect all the 108 people in the famous novel Water Margin, you will...

HDU 4336 – Card Collector [状压概率DP]

Link http://acm.hdu.edu.cn/showproblem.php?pid=4336 Problem In your childhood, do you crazy for collecting the beautiful cards in the snacks? They ...
阅读全文 0

CodeForces 668B – Little Artem and Dance [规律]


Link 传送门 Problem Little Artem is fond of dancing. Most of all dances Artem likes rueda — Cuban dance that is danced by pairs of boys and girls forming a circle and dancing together. More detailed, there are n pairs of boys and girls standing i...

CodeForces 668B – Little Artem and Dance [规律]

Link 传送门 Problem Little Artem is fond of dancing. Most of all dances Artem likes rueda — Cuban dance that is danced by pairs of boys and girls ...
阅读全文 0

山东科技大学 第三届ACM程序设计大赛 解题报告


这次校赛是组队赛,和LJR WWZ组队。状态比去年要好一点,不过最后比较卡,思路不开阔。一共做了7个题,罚时比别人多了好多,主要是因为中间有道题题意不太清楚坑了好几遍。 Problem A: LOL少年 Description 小R最近喜欢上了LOL,他很想在游戏中记录下来自己的精彩瞬...

山东科技大学 第三届ACM程序设计大赛 解题报告

这次校赛是组队赛,和LJR WWZ组队。状态比去年要好一点,不过最后比较卡,思路不开阔。一共做了7个题,罚时比别人多了好多,主要是因为中间有道题题意不太清...
阅读全文 0

CodeForces 660E – Different Subsets For All Tuples [DP]


Link 传送门 Problem For a sequence a of n integers between 1 and m, inclusive, denote f(a) as the number of distinct subsequences of a (including the empty subsequence). You are given two positive integers n and m. Let S be the set of all sequenc...

CodeForces 660E – Different Subsets For All Tuples [DP]

Link 传送门 Problem For a sequence a of n integers between 1 and m, inclusive, denote f(a) as the number of distinct subsequences of a (including ...
阅读全文 0

LeetCode #31 – Next Permutation [next_permutation函数原理]


Link 传送门 Problem Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers. If such arrangement is not possible, it must rearrange it as the lowest possible order (ie, sorted in ascendin...

LeetCode #31 – Next Permutation [next_permutation函数原理]

Link 传送门 Problem Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers. If such ar...
阅读全文 0

LeetCode #30 – Substring with Concatenation of All Words [map]


Link 传送门 Problem You are given a string, s, and a list of words, words, that are all of the same length. Find all starting indices of substring(s) in s that is a concatenation of each word in wordsexactly once and without any intervening charac...

LeetCode #30 – Substring with Concatenation of All Words [map]

Link 传送门 Problem You are given a string, s, and a list of words, words, that are all of the same length. Find all starting indices of substring(...
阅读全文 0

HDU 1814 – Peaceful Commission [2-SAT]


Link 传送门 Problem The Public Peace Commission should be legislated in Parliament of The Democratic Republic of Byteland according to The Very Important Law. Unfortunately one of the obstacles is the fact that some deputies do not get on with som...

HDU 1814 – Peaceful Commission [2-SAT]

Link 传送门 Problem The Public Peace Commission should be legislated in Parliament of The Democratic Republic of Byteland according to The Very Imp...
阅读全文 0