背包问题,可以很明显的判断为背包问题,因为他要求所有的 砝码都必须放上去,于是乎就变成了 01背包了 ,每种状态的取决于前一个状态,然后分析一下,因为他有-15 由于杠杆原理可以很清楚的知道最小的 为 20*15*25 于是就将状态平衡的位置进行相应的 移到了 dp【7500】;好了现在问题都解决了 接下来进行dp就可以了#include #include#i
原创 2021-07-28 11:56:45
70阅读
http://poj.org/problem?id=1837#include#include#include#include#include#includeusing namespace std;int dp[21][15001];int m
原创 2023-08-23 09:54:49
46阅读
BalanceTime Limit: 1000MSMemory Limit: 30000KTotal Submissions: 8754Accepted: 5320DescriptionGigel has a strange "balance" and he wants to poise it. Actually, the device is different from any other ordinary balance. It orders two arms of negligible weight and each arm's length is 15. S
原创 2021-07-29 16:22:32
123阅读
题意:给你C个挂钩,W个钩码,要你能使一个天平平衡 数据解释: 2 4 -2 3 3 4 5 8 以原点为支点。那么-2代表支点左边2处有一个钩码,同理3代表右边的点 所以案例数据有一个成立的样例是(3+5)*3=(4+8)*2或是(3+4+5)*2=8*3(力臂平衡) 有2种情况所以输出2; 思路
转载 2017-04-12 17:27:00
58阅读
2评论
#include<iostream> //dpusing namespace std;const int m=7505;int w[25],hook[25],dp[25][2*m];int main(){ int c,g,i,j,k; cin>>c>>g; for(i=1;i<=c;++i) { cin>>hook[i]; } for(i=1;i<=g;++i) { cin>>w[i]; } for(i=1;i<=c;++i) dp[1][hook[i]*w[1]+m]++; //+m 使得dp数组的下标可以不小于0
转载 2011-07-22 19:11:00
67阅读
2评论
一开始看到这个题 第一反应:暴搜! 看看数据范围 。。。放弃了然后就在各种憋状态转移方程。 各种不会 还是看了Discuss里面说的才有点儿思路 直接放状态转移方程: f[i][ j+ w[i]*c[k] ]= ∑(f[i-1][j])#include...
转载 2016-03-06 11:43:00
51阅读
2评论
Description Gigel has a strange "balance" and he wants to poise it. Actually, the device is different from any other ordinary balance.  It orders two arms of negligible weight and each
原创 2022-11-09 20:00:30
79阅读
// 1644K 16MS G++#include #include #include using namespace std;#define MAX_W 25#define MAX_W_NUM 20#define MAX_L 15
原创 2023-05-23 16:04:23
68阅读
题目大意: 一个天平,给你一些挂钩(固定的),砝码,要求砝码全用,挂钩可以只用一些,砝路:因为砝码需要全用,所以...
原创 8月前
79阅读
题意:有一个天平,两个臂上有钩子,给出所有钩子的位置,给出每个钩码的重量(各不相同),求必须使用所有钩码的前提下,有多少种平衡方法。分析:dp,f[i][j + 5000]表示用前i个砝码到达力矩j的方法数f[i + 1][j + hook[k] * weight[i]] += f[i][j];最终结果存储在f[n][5000]中。View Code #include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>usingnamespace std;#define
转载 2011-06-09 18:36:00
63阅读
2评论
Balance POJ - 1837 题目大意: 有一个天平,天平左右两边各有若干个钩
要好好用心体会啊,。#include#include#include#include#include#include#include#include#include#include#include#includeusing namespace std;int balance[21][nt h
原创 2023-07-27 18:39:08
50阅读
题目:POJ 1837 Balance题意:给一个天平,天平的左右臂长都为15,现
原创 2022-11-18 16:10:55
38阅读
POJ1837 DP题题目一开始看了N久…意思大概是有一个天平
原创 2023-06-12 14:20:31
66阅读
题意: 有一根杆子,给出一些杆子上的位置,位置上能放重物,再给出一些重物的重量。 重物都需要被使用,但是位置不一定都要用到。 问你能有多少种方法让这个杆子平衡。 思路: 在位置上是0/1背包思想,取或不取。dp[]直接代表在该重量下有多少方案数。 最大的重量是20*25*15=75...
转载 2016-07-24 21:01:00
50阅读
题目传送门平衡问题,把每个砝码在每个位置的权值算出来,每个砝码一个分组,几个位置几个物品,最后求的是价值
原创 2022-07-08 10:18:43
46阅读
http://acm.timus.ru/problem.aspx?space=1&num=1837 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 using namespace std; 9 vectorq[500]; 10 11 struct node 12 { 13 string s; 14 int num; 15 bool operator qq; 35 bool vis[50000]; 36 memse...
转载 2014-03-18 21:09:00
103阅读
2评论
Descr
原创 2022-08-10 11:04:38
41阅读
这题居然不用高精度就能过……测试数据好弱Program P1837;var c,g,i,j,k,p:longint; li,w:array[1..20] of longint; f:array[1..20,-7500..7500] of longint;begin fillchar(f,sizeof(f),0); read(c,g); for i
原创 2012-08-13 14:03:43
65阅读
1837被数据结构部分打击的不行了 换地 刷点简单的 图论第一题 floyd水过 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 using namespace std; 9 int w[310][310];10 #define INF 0xfffffff11 mapf;12 struct node13 {14 char s[22];15 int id;16 }p[310];17 bool cmp(node a,node b)18 {19 return str...
转载 2013-10-04 13:26:00
58阅读
2评论
  • 1
  • 2
  • 3
  • 4
  • 5