![](https://img-blog.csdnimg.cn/20201014180756916.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
信息
文章平均质量分 70
thy0311
这个作者很懒,什么都没留下…
展开
-
usaco2.4.6分数化小数
/* ID:thy47021 PROG:fracdec LANG:C++*/#include#include #include using namespace std;int yushu[1000002],k=0,k1=0,k2=0;struct aaa{bool a1;int wei;}hash[1000002];void huanhuan原创 2014-07-16 19:51:19 · 326 阅读 · 0 评论 -
usaco2.4.5回家
不得不说,这是一道#include #include #include #include using namespace std;struct aaaa{char zimu;int wz;}mch[60];int map[70][70],n,m=0,dis[60];bool key[70];void aaa(void);int main()原创 2014-07-18 15:43:37 · 311 阅读 · 0 评论 -
usaco2.4.4牛的旅行
这道题个人觉得很恶心,看了ti'j原创 2014-07-19 16:59:46 · 458 阅读 · 0 评论 -
usaco2.4.3穿越栅栏(最短路)
这题一开始就建了一个4维数组,结果交上去chao'chu'kong'ji原创 2014-07-18 14:52:18 · 385 阅读 · 0 评论 -
混合背包(样式)维基3269
#include#include#includeusing namespace std;const int maxn=200+10,maxc=200000+10;int f[maxc],v[maxn],w[maxn],m[maxn],n,V;void complete_pack(int cost,int weight){for(int j=cost;jf[j]=原创 2014-07-12 17:48:21 · 394 阅读 · 0 评论 -
usaco2.3.2奶牛家谱
#include#include#include#include using namespace std;int n,h;int aaa(int h1,int n1,int key);int main(){ //freopen("nocows.in","r",stdin); //freopen("nocows.out","w",stdout); c原创 2014-07-15 17:01:29 · 386 阅读 · 0 评论 -
维基1169传纸条
这是高级一点的棋盘型dp,需要两条路径,这就需要原创 2014-07-15 21:44:04 · 299 阅读 · 0 评论 -
usaco2.4.2两只塔姆沃斯牛
注意最大的时间,如果盲目开大一点,只会超时,所以要掐de'gang'gang'hao原创 2014-07-16 13:58:40 · 536 阅读 · 0 评论 -
石子归并
这种区间型的dp,是我今天第一次接触。动态规划思路: 阶段i:石子的每一次合并过程,先两两合并,再三三合并,...最后N堆合并 状态s:每一阶段中各个不同合并方法的石子合并总得分。 决策:把当前阶段的合并方法细分成前一阶段已计算出的方法,选择其中的最优方案原创 2014-07-17 16:47:28 · 353 阅读 · 0 评论 -
nsaco3.1.邮票
一道简单的背包,至于什么类型的背包,我是把他变成#include #include #include #include #include using namespace std;int k,n;int f[2000001],value[51];int main(){ //freopen("stamps.in","r",stdin); //原创 2014-07-20 15:49:25 · 274 阅读 · 0 评论 -
usaco3.1.6联系
这道题要分别算出不同长度的mei原创 2014-07-20 18:22:59 · 419 阅读 · 0 评论 -
usaco3.1.2最短网络
这是一道最小生成树的问题,用#include #include #include #include using namespace std;int n,key[110],zdlu[110],map[110][110];int main(){ freopen("agrinet.in","r",stdin); freopen("agrinet原创 2014-07-19 18:26:26 · 306 阅读 · 0 评论 -
usaco3.1.3总分
这道题是一道完全背包问题,没有任何包装,比较简单。原创 2014-07-20 14:27:40 · 311 阅读 · 0 评论 -
usaco3.1.5形成的区域
#include #include #include #include #include using namespace std;int ans[3000],n;struct sfaf{int x1;int y1;int x2;int y2;int color;}tu[1010];void piaofu(int x1,int x2,int y1,int y2,int原创 2014-07-21 15:52:08 · 453 阅读 · 0 评论 -
usaco3.1.4丑数
主要是生成yo'ge'ge#include #include #include #include #include using namespace std;int k,n,kk=0,num=1,shu[110],wei[110];long long ans[300000];int main(){ //freopen("humble.in","r",原创 2014-07-21 17:47:02 · 386 阅读 · 0 评论 -
usaco3.2.2阶乘
主要是看出末尾最多有几个0么么哒。#include #include #include #include #include using namespace std;int ss[2200];int main(){ //freopen("fact4.in","r",stdin); //freopen("fact4.out","w",stdout原创 2014-07-21 20:19:43 · 500 阅读 · 0 评论 -
usaco3.2.3 01串
/* ID:thy47021 PROG:kimbits LANG:C++*/#include #include #include #include #include using namespace std;int ss[35],n,l;long long m,k=0,dp[35][35];bool flag;void aaa(int原创 2014-07-22 16:49:45 · 329 阅读 · 0 评论 -
usaco3.2.4纺车的轮子
#include #include #include #include #include using namespace std;int v[6],shu[6];struct abc{int qi,chang;}dong[6][6];int main(){ //freopen("spin.in","r",stdin); //freopen("原创 2014-07-23 15:37:10 · 386 阅读 · 0 评论 -
路中信息竞赛No.1解题报告
解题报告: 1.愤怒的大锤(angry.cpp/c/pas)【问题描述】大家好,我叫王大锤!今天,我看到一个和我长得一模一样的人他叫段公子。(A:什么!你确定一模一样?照镜子呢吧你!王:真的,听说别人叫他陈大锤。)我很生气,抓住他的头发,甩他,使其做匀速圆周运动(A:圆周运动!你这是要闹哪样啊!),我告诉你他的身高l(m),及角速度w(rad/s),请你求出他的原创 2014-07-05 14:49:09 · 373 阅读 · 0 评论 -
线段树讲义
线段树讲义例题:在自然数,且所有的数不大于30000的范围内讨论一个问题:现在已知n条线段,把端点依次输入告诉你,然后有m个询问,每个询问输入一个点,要求这个点在多少条线段上出现过(0 最基本的解法当然就是读一个点,就把所有线段比一下,看看在不在线段中;每次询问都要把n条线段查一次,那么m次询问,就要运算m*n次,复杂度就是O(m*n)这道题m和n都是30000,那么计算量转载 2014-07-05 19:57:08 · 464 阅读 · 0 评论 -
维基 1219 骑士游历
这道题告诉你了递归与for的速度差距for循环:原创 2014-07-06 10:18:14 · 463 阅读 · 0 评论 -
动态规划索引
1. 资源问题1 -----机器分配问题 F[I,j]:=max(f[i-1,k]+w[i,j-k]) 2. 资源问题2 ------01背包问题 F[I,j]:=max(f[i-1,j-v[i]]+转载 2014-07-05 19:56:30 · 354 阅读 · 0 评论 -
城堡(简单但费时)
/* ID: thy47021 PROG: castle LANG: C++ */ #include #include #include using namespace std; int mp[55][55]; int room[2555]; int roomnum[55][55]; int sum, size, m, n;原创 2014-07-05 19:37:10 · 332 阅读 · 0 评论 -
usaco3.2.5饲料调配
这题听说可以用行列式,但我不会。#include #include #include #include #include using namespace std;int s[5][5],s1[4];bool flag[4];bool flag1;int main(){ //freopen("ratios.in","r",stdin);原创 2014-07-25 16:26:34 · 1206 阅读 · 0 评论 -
usaco3.2.6魔板
#include #include using namespace std;struct data{ int last,deep,opr,x;}q[100000];bool use[8][8][8][8][8][8][8];int main(){ //freopen("msquare.in","r",stdin); //freopen("msquar原创 2014-07-26 17:45:56 · 461 阅读 · 0 评论 -
usaco 2.3.5控制公司
这道题貌似不用动规就可以做了,主要是看清原创 2014-07-10 19:23:17 · 611 阅读 · 0 评论 -
usaco3.4.4电网(新 数)皮克定理
#include#include#include #include #include using namespace std;int gb(int a,int b);int main(){ //freopen("fence9.in","r",stdin); //freopen("fence9.out","w",stdout); int原创 2014-08-03 16:54:09 · 311 阅读 · 0 评论 -
usaco3.4.3美国血统
这道题目主要是对二叉树bian'li'de'li'jie原创 2014-08-03 22:26:00 · 454 阅读 · 0 评论 -
usaco3.3.4亚瑟王的宫殿
一个万无一失的方法对于骑士带王去会合的情况,枚举王的原位置和八个方向,也就是说王和骑士的汇合点相对于王的原位置为上下左右或者斜45度方向。比如在8*8的棋盘上,王的位置用k表示,需要枚举的带王的点用1表示,其余点用0表示则有下图:0 0 1 0 0 1 0 01 0 1 0 1 0 0 00 1 1 1 0 0 0 01 1 k 1 1 1 1 10 1 1 1 0 0原创 2014-08-03 15:53:13 · 610 阅读 · 0 评论 -
usaco3.4.5“破锣摇滚”乐队
背包问题,只不过有了多个背包。虽然dai#include#include#include #include #include using namespace std;int f[21][21],T[21];int main(){ //freopen("rockers.in","r",stdin); //freopen("rockers.o原创 2014-08-03 17:23:35 · 568 阅读 · 0 评论 -
wikioi1039数的划分(划分型dp)
题目描述 Description将整数n分成k份,且每份不能为空,任意两种划分方案不能相同(不考虑顺序)。例如:n=7,k=3,下面三种划分方案被认为是相同的。1 1 51 5 15 1 1问有多少种不同的分法。输入描述 Input Description输入:n,k (6输出描述 Output Descr原创 2014-08-04 10:24:13 · 1190 阅读 · 0 评论 -
usaco2.3.4货币系统
看完《》背包九讲就会了#include#include#includeusing namespace std;int s[30];long long f[10010];int main(){ freopen("money.in","r",stdin); freopen("money.out","w",stdout); int n,v;原创 2014-07-12 20:09:24 · 335 阅读 · 0 评论 -
usaco2.3.3和为零
zerosum原创 2014-07-12 21:33:35 · 371 阅读 · 0 评论 -
usaco3.2.7香甜的奶油
这道题,典型的最短路。一开始求方便,用Floyd-Warshall算法原创 2014-07-29 17:15:19 · 440 阅读 · 0 评论 -
wikioi线段覆盖
#include #include #include using namespace std;struct aaa{int le;int ri;}s[110];int n;bool cmp(aaa a,aaa b){ return a.le }int main(){ int x=0; scanf("%d",&n); i原创 2014-08-05 15:24:28 · 350 阅读 · 0 评论 -
wikioi1068乌龟棋
感觉像变态的背包状态转移方程为:f(i,j,k,l)=max{f(i-1,j,k,l)+a[(i-1)*1+j*2+k*3+l*4+2],f(i,j-1,k,l)+a[i*1+(j-1)*2+k*3+l*4+3],f(i,j,k-1,l)+a[i*1+j*2+(k-1)*3+l*4+4],f(i,j,k,l-1)+a[i*1+j*2+k*3+(l-1)*4+原创 2014-08-06 13:42:50 · 349 阅读 · 0 评论 -
usaco3.3.6游戏
一题典型的区间型dp,如果要sou'suo'de'hu原创 2014-07-31 14:05:32 · 243 阅读 · 0 评论 -
wikioi1004四子连棋
这题是一题搜索题,我用广搜。hai原创 2014-08-06 06:59:26 · 527 阅读 · 0 评论 -
usaco(wikioi)3.3.5家的范围
一开始用的搜索,结果超时了。。。后来受到启发,是棋盘型dp原创 2014-07-30 17:44:15 · 268 阅读 · 0 评论 -
usaco3.3.3 商店购物
这是一道典型的多维背包dp,主要在于如何处理数据,其他没有难点。/* ID:thy47021 PROG:shopping LANG:C++*/#include #include #include #include #include #include using namespace std;struct aaaa{int hao,shu原创 2014-07-30 16:17:40 · 365 阅读 · 0 评论