原题链接: http://acm.hdu.edu.cn/showproblem.php?pid=1455一:原题内容Problem DescriptionGeorge took sticks ong. N
原创 2022-12-07 00:50:46
89阅读
Sticks Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 8353 Accepted Submission(s): 2438 Problem
转载 2016-03-05 16:10:00
54阅读
2评论
SticksTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K
原创 2022-08-05 11:25:20
74阅读
``` include include include include include using namespace std; int n, targetnum, targetlen; int sumlen = 0; int stick[1000]; bool vis[1000]; bool cm
原创 2021-12-28 17:11:45
29阅读
这题让我看解题报告都感觉弱无力的样子,囧rz题意:几根原本长度相同的木棒,然后被某人当出气筒剪啊剪啊,剪成好几段,然后,好吧,这时间一长记性就差了,忘了原来这堆木棒的长度。输出可能的最短长度如果说思路大概懂,但是代码看不懂,最好的办法就是在纸上模拟,或者把别人代码在计算机上一步一步跟踪调试。首先原长...
转载 2014-08-06 16:53:00
43阅读
2评论
非常经典的搜索剪枝,剪枝说明见程序:#include #include using namespace std;int l,total,n,sum;struct node{ int l; bool flag; friend bool operator b.l; }}stick[100];bool dfs(int s,int nl,int pos){ if(s==total-1)return true; //最后一根不必搜,因为加起来一定为l for(int i=pos+1;i<=n;i++){ //记录上一次搜到的地方,不要从第一个重新开始搜 ...
转载 2014-02-10 15:38:00
26阅读
2评论
DFS+剪枝!!!!! 这是继上一个,做的加难的一个。难了一点点!! 非常幸运0MS过!! AC代码例如以下: ///dfs+剪枝 0MS 236K #include<iostream> #include<cstdio> #include<algorithm> #include<cstring> u
转载 2017-06-12 16:15:00
53阅读
2评论
Sticks Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u Submit Status Practice HDU 1455 Sticks Submit Status Practice HDU 1455 Des
转载 2016-07-30 10:35:00
55阅读
2评论
讲的大致是几根原本长度相同的木棒,然后被某人当出气筒剪啊剪啊,剪成好几段,然后,好吧,这时间一长记性就差了,忘了原来这堆木棒的长度。。。orz,我这若菜,也只能帮您推算出原来这堆木棒的可能的最短长度了
转载 2013-01-28 16:19:00
97阅读
2评论
题干: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, bu
原创 2022-06-18 00:25:06
53阅读
题目大意:经典深搜给你若干根短棒,将其组合成等长的木棒,尽可能短,并输出其长度 代码如下:/* * 1455_3.cpp * * Created on: 2013年8月23日 * Author: Administrator */#include using namespace std;/** * kp[] :用来记录被剪后每根木棒的长度 * mark[] :用来标记是否访问过 * n : 被剪后木棒的根数 * sum :木棒的总长度 * flag : 用来标记是否成功 * len : 组合后木棒的长度 * parts :组合后木棒的根数 */int kp[65];bool mark...
转载 2013-08-23 19:05:00
39阅读
2评论
Sticks题目大意是,给你一个数字n代表总共的棍子数量,要做的就是,把这几根棍子拼成长度相同的棍子,并且让所拼成的棍子的长度尽可能地小,也就是拼成的棍子的数量尽可能的多。在这里很简单的想到要给棍子排一下序,这样可以更简单找到合适棍子的。
原创 2021-08-26 16:26:00
99阅读
Sticks Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 9414 Accepted Submission(s): 2776 Problem
原创 2021-07-21 15:47:42
35阅读
题目大意:经典深搜   给你若干根短棒,将其组合成等长的木棒,尽可能短 ,并输出其长度代码如下:/* * 1455_3.cpp * * Created on: 2013年8月23日 * Author: Administrator */#include using namespace std;/** * kp[] :用来记录被剪后每根木棒的
原创 2023-04-11 14:56:07
57阅读
题目地址:点击打开链接题意:小明拿来几根相同长度的棍子,然后把这些棍子截成好几节,问最后能拼成几根长度相同的棍子(要求这些棍子的长度最小)思路:和HDU1518相似,可以看本博客,那道题解写的比较详细,这不过这道题得在那道题上多加几个减枝才能AAC代码:#include #include #include #include #include #include #incl
原创 2022-08-04 09:19:39
10阅读
Sticks Time Limit: 2000/1000 MS (Java/Others)
原创 2023-04-23 21:42:08
290阅读
1455: A>B? Time Limit: 1 Sec  Memory Limit: 128 MB [Submit][Status][Web Board] Description 下午4:30,小明和小黄在str实验室A题,小黄对小明说:好饿啊,去不去食堂吃饭?小明说:等一下!我要把这题码出来,XXOJ马上破200了。可是....... 一个小时以后,小明还是停留在#includ
原创 2022-09-07 10:59:18
62阅读
简单题View Code #include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>using namespace std;int main(){ int t; scanf("%d", &t); while (t--) { int n; scanf("%d", &n); int ans = (1 + n / 2 - 1) * (n / 2 - 1) / 2 * 2; if (n & 1) ans +
转载 2013-03-27 16:41:00
38阅读
2评论
学习了一下可合并堆的一种写法——左偏树感觉左偏树是一种类似启发式的方法学习左偏树后这题就水过去了 1 var fa,l,r,a,d:array[0..1000010] of longint; 2 v:array[0..1000010] of boolean; 3 i,n,m,x,y,f:longint; 4 ch:char; 5 6 function ge
转载 2015-01-26 17:56:00
59阅读
2评论
1455. 检查单词是否为句中其他单词的前缀给你一个字符串 sentence 作为句子并指定检索词为 searchWord ,其中句子由若干用 单个空格 分隔的单词组成。请你检查检索词 searchWord 是否为句子 sentence 中任意单词的前缀。如果 searchWor
原创 2023-11-15 15:15:17
117阅读
  • 1
  • 2
  • 3
  • 4
  • 5