Hanoi TowerTime Limit: 2 Seconds Memory Limit: 65536 KBYou all must know the puzzle named "The Towers of Hanoi". The puzzle has three pegs (peg 1, peg...
分类:
其他好文 时间:
2016-01-21 19:13:06
阅读次数:
165
Then-queens puzzle is the problem of placingnqueens on ann×nchessboard such that no two queens attack each other.Given an integern, return all distinc...
分类:
其他好文 时间:
2016-01-05 00:06:12
阅读次数:
193
Problem Descriptionlcy gives a hard puzzle to feng5166,lwg,JGShining and Ignatius: gave a and b,how to know the a^b.everybody objects to this BT probl...
分类:
其他好文 时间:
2015-12-30 21:43:00
阅读次数:
145
题目来源https://leetcode.com/problems/n-queens/Then-queens puzzle is the problem of placingnqueens on ann×nchessboard such that no two queens attack each ...
分类:
编程语言 时间:
2015-12-28 14:15:49
阅读次数:
180
#include#includeusing namespace std;using namespace std;const int maxn=100000+10;int a[maxn],b[maxn];int main(){ int n,m; while(scanf("%d %d",&n...
分类:
其他好文 时间:
2015-12-27 19:10:10
阅读次数:
225
题目:The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other.Given an integer n, return al...
分类:
其他好文 时间:
2015-12-26 18:25:36
阅读次数:
155
题意:有N个珠宝 M个箱子 珠宝价值a 箱子价值b每个珠宝放在箱子里,花费abs(a-b)箱子可以无限放珠宝求最小花费水题预处理每个价值的珠宝所放的箱子O(n)从左往右找到最接近的左箱子l 从右往左找到最接近的右箱子r取min#include#include#include#include#incl...
分类:
其他好文 时间:
2015-12-26 18:25:19
阅读次数:
181
题目链接给一串数, 拿出一个数i的代价是a[i-1]*a[i]*a[i+1], 第一个数和最后一个数不能拿, 求拿走剩下的数的代价的最小值。#include #include #include #include #include #include #include #include #include...
分类:
其他好文 时间:
2015-12-24 10:41:05
阅读次数:
110
题目:Write a program to solve a Sudoku puzzle by filling the empty cells.Empty cells are indicated by the character '.'.You may assume that there will b...
分类:
其他好文 时间:
2015-12-23 16:14:23
阅读次数:
135
题意:给一个序列,每次选一个数(记为b),计算左边离他最近的数(记为a),右边离他最近的数(记为c),计算a*b*c,sum+=a*b*c 重复操作直到剩下开头结尾两个数不同的方案对应不同的sum 计算最小的sum值分析:典型的区间dp,dp[i][j]表示把从i到j所有的数都选走得到的最小值dp[...
分类:
其他好文 时间:
2015-12-21 23:40:10
阅读次数:
162