A. Cakeminatortime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given a rectangular cake, represented as an r × c grid. Each cell either has an evil strawberry, or is empty. For example, a 3
A. Down the Hatch!time limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputEverybody knows that the Berland citizens are keen on health, especially students. Berland students are so tough that all they
B. Road Constructiontime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputA country has n cities. Initially, there is no road in the country. One day, the king decides to construct some roads
HDU-1427-速算24點http://acm.hdu.edu.cn/showproblem.php?pid=14274個數通過 +,—,*,/和加括弧,計算得24,枚舉數字和運算子,DFS即可,注意題目要求計算過程中都不能出現小數,所以做除法時稍作處理枚舉數組可用algorithm裡的next_permutationThe next_permutation() function attempts to transform the given range of elements [start,
http://codeforces.com/problemset/problem/320/AA magic number is a number formed by concatenation of numbers 1, 14 and 144. We can use each of these numbers any number of times. Therefore14144, 141414 and 1411 are magic numbers but 1444, 514 and 414
HDU-1298-T9http://acm.hdu.edu.cn/showproblem.php?pid=1298很好的一題,字典樹+DFS,思路參考swm8023大牛的題意是類比手機IME,給出幾個單詞即頻度,再給出幾個數字串,確定對於給定的一個數字串,每輸入一個數字,將顯示什麼字元本題的數字串的每一個數字均代表一個字母,而不是平常的手機,多個數字可能代表一個字母,首先可將給出的單詞即頻度記錄到字典樹中,對於數字串進行DFS,尋找其可能表示的頻度最大的字串例如 ab 2
HDU-1075-What Are You Talking Abouthttp://acm.hdu.edu.cn/showproblem.php?pid=1075字典樹#include<iostream>#include<cstdio>#include<cstring>#include<cstdlib>using namespace std;struct node{int count;node *childs[26];char