Vijos P1988 – 自行车比赛 [贪心]


Link https://vijos.org/p/1988 Problem 小雪非常关注自行车比赛,尤其是环滨湖自行车赛。一年一度的环滨湖自行车赛,需要选手们连续比赛数日,最终按照累计得分决出冠军。今年一共有N位参赛选手。每一天的比赛总会决出当日的排名,第一名的选手会获得N点得分,第二...

Vijos P1988 – 自行车比赛 [贪心]

Link https://vijos.org/p/1988 Problem 小雪非常关注自行车比赛,尤其是环滨湖自行车赛。一年一度的环滨湖自行车赛,需要选手们连续比赛数日,最终按照累计...
阅读全文 0

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...
阅读全文 0

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

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

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

HDU 1274 – 展开字符串 [递归]


Link 传送门 Problem 在纺织CAD系统开发过程中,经常会遇到纱线排列的问题。 该问题的描述是这样的:常用纱线的品种一般不会超过25种,所以分别可以用小写字母表示不同的纱线,例如:abc表示三根纱线的排列;重复可以用数字和括号表示,例如:2(abc)表示abcabc;1(a)...

HDU 1274 – 展开字符串 [递归]

Link 传送门 Problem 在纺织CAD系统开发过程中,经常会遇到纱线排列的问题。 该问题的描述是这样的:常用纱线的品种一般不会超过25种,所以分别可以用小写字...
阅读全文 0

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...
阅读全文 0

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...
阅读全文 0

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...
阅读全文 0

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...
阅读全文 0