暴力回溯
文章平均质量分 52
七月初七小柠七
人生在世,事业为重。
一息尚存,绝不松劲!
展开
-
Sticks (dfs经典剪枝)
George took sticks of the same length and cut them randomly until all parts became at most 50 units long. Now he wants to return sticks to the original state, but he forgot how many sticks he had orig原创 2017-12-08 17:13:36 · 2590 阅读 · 0 评论 -
拉丁矩阵问题
现有n种不同形状的宝石,每种宝石有足够多颗。欲将这些宝石排列成m行n列的一个矩阵,m输入: 3 3输出: 12#include#define n 3#define m 3int a[n][m];int count=0;int judge(int hang,int lie){ int i; for(i=0原创 2017-11-23 16:25:01 · 1021 阅读 · 0 评论 -
0-1背包(回溯法剪枝版)
#include#define n 3int maxvalue=0,tot=0;int w[n]={16,15,15},v[n]={45,25,25},c=30;int tempweight=0,tempvalue=0;void dfs(int t){ if(t==n) { if(tempvalue>maxvalue && tempwe原创 2017-11-22 17:09:57 · 1200 阅读 · 0 评论 -
Fox And Two Dots
Fox Ciel is playing a mobile puzzle game called "Two Dots". The basic levels are played on a board of sizen × m cells, like this:Each cell contains a dot that has some color. We will use diffe原创 2017-12-04 21:34:37 · 254 阅读 · 0 评论 -
crash(dfs)
Description某个6.1儿童节,nc和zxl参加了一场踩气球的游戏,规则如下: 一共有99个气球,标号为2~99,nc和zxl去踩气球,每踩爆一个好的气球,踩的人就拿自己目前的分值乘以气球的标号(初始分值为 1),一定时间后,所有气球都会消失,然后nc和zxl都会上报自己最后的分数,这时候有你来判断胜负。为什么要判断呢,因为他俩的数学不太好,会出现算 错的情况,然后你就要根据以下规则判断了...原创 2018-03-15 17:20:00 · 218 阅读 · 0 评论 -
Faulty Robot
5094: Faulty Robot时间限制: 1 Sec 内存限制: 128 MB提交: 85 解决: 27[提交][状态][讨论版][命题人:admin]题目描述As part of a CS course, Alice just finished programming her robot to explore a graph having n nodes, labeled 1, 2, ....原创 2018-04-23 18:07:01 · 386 阅读 · 0 评论