### CodeForces 589K – Task processing [暴力/数学/优先队列]

Link http://codeforces.com/problemset/problem/589/K Problem Vasya wants to create a computing system to process arbitrary tasks. As a part of the system he needs an algorithm which will choose an order of task execution. He came up with the follow...

#### CodeForces 589K – Task processing [暴力/数学/优先队列]

Link http://codeforces.com/problemset/problem/589/K Problem Vasya wants to create a computing system to process arbitrary tasks. As a part of the s...

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

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

### 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 ...

### 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...

### hihoCoder #88 – Coordinates [简单数学]

Link 传送门 Problem Give you two integers P and Q. Let all divisors of P be X-coordinates. Let all divisors of Q be Y-coordinates. For example, when P=6 and Q=2, we can get the coordinates (1,1) (1,2) (2,1) (2,2) (3,1) (3,2) (6,1) (6,2). You shoul...

#### hihoCoder #88 – Coordinates [简单数学]

Link 传送门 Problem Give you two integers P and Q. Let all divisors of P be X-coordinates. Let all divisors of Q be Y-coordinates. For example, whe...

### CodeForces 622C – Not Equal on a Segment [巧打表]

Link 传送门 Problem You are given array a with n integers and m queries. The i-th query is given with three integers li, ri, xi. For the i-th query find any position pi (li ≤ pi ≤ ri) so that api ≠ xi. The first line contains two integers n, m (1 ...

#### CodeForces 622C – Not Equal on a Segment [巧打表]

Link 传送门 Problem You are given array a with n integers and m queries. The i-th query is given with three integers li, ri, xi. For the i-th query...

### HDU 1671 – Phone List [排序]

Link 传送门 Problem Given a list of phone numbers, determine if it is consistent in the sense that no number is the prefix of another. Let’s say the phone catalogue listed these numbers: 1. Emergency 911 2. Alice 97 625 999 3. Bob 91 12 54 26 In t...

#### HDU 1671 – Phone List [排序]

Link 传送门 Problem Given a list of phone numbers, determine if it is consistent in the sense that no number is the prefix of another. Let’s say th...

### UVa 254 – Towers of Hanoi [汉诺塔+二进制]

Link 传送门 Problem In 1883, Edouard Lucas invented, or perhaps reinvented, one of the most popular puzzles of all times – the Tower of Hanoi, as he called it – which is still used today in many computer science textbooks to demonstrat...

#### UVa 254 – Towers of Hanoi [汉诺塔+二进制]

Link 传送门 Problem In 1883, Edouard Lucas invented, or perhaps reinvented, one of the most popular puzzles of all times – the Tower of Hanoi...