摘要: 圈水池时间限制:3000 ms | 内存限制:65535 KB难度:4描述有一个牧场,牧场上有很多个供水装置,现在牧场的主人想要用篱笆把这些供水装置圈起来,以防止不是自己的牲畜来喝水,各个水池都标有各自的坐标,现在要你写一个程序利用最短的篱笆将这些供水装置圈起来!(篱笆足够多,并且长度可变)输入第一... 阅读全文
posted @ 2013-04-27 21:44 YaLing 阅读(229) 评论(0) 推荐(0) 编辑
摘要: 过河问题时间限制:1000 ms | 内存限制:65535 KB难度:5描述在漆黑的夜里,N位旅行者来到了一座狭窄而且没有护栏的桥边。如果不借助手电筒的话,大家是无论如何也不敢过桥去的。不幸的是,N个人一共只带了一只手电筒,而桥窄得只够让两个人同时过。如果各自单独过桥的话,N人所需要的时间已知;而如... 阅读全文
posted @ 2013-04-27 15:21 YaLing 阅读(217) 评论(0) 推荐(0) 编辑
摘要: 喷水装置(二)时间限制:3000 ms | 内存限制:65535 KB难度:4描述有一块草坪,横向长w,纵向长为h,在它的橫向中心线上不同位置处装有n(nb),且就像上边所说的[x,y]应该是最大的,才能保证最后所需子区间的个数最小...12#include3#include4#include5#i... 阅读全文
posted @ 2013-04-27 14:11 YaLing 阅读(235) 评论(0) 推荐(0) 编辑
摘要: 1#include<iostream>2#include<algorithm>3#include<memory.h>4usingnamespacestd;5structtime{6intbt,et;7intt0;8};9structtimet[10001];1011boolcmp(structtimet1,structtimet2)12{13returnt1.bt<t2.bt||(t1.bt==t2.bt&&t1.et<t2.et);14}1516intmain()17{18intn,T,i,j,s,m;19cin>> 阅读全文
posted @ 2013-04-26 21:16 YaLing 阅读(178) 评论(0) 推荐(0) 编辑
摘要: 1#include2#include3#include4usingnamespacestd;5inta[]={1,2,6,24,120,720,5040,40320,362880};6intmain()7{8intn,t,i,s;9cin>>t;10while(t--)11{12cin>>n;13s... 阅读全文
posted @ 2013-04-26 20:47 YaLing 阅读(136) 评论(0) 推荐(0) 编辑
摘要: 1#include2#include3#include4usingnamespacestd;5longlonga[64][64];6intmain()7{8intm,n,i,j;9a[0][0]=a[1][0]=a[1][1]=1;10for(i=2;i<64;i++)11{12a[i][0]=1;... 阅读全文
posted @ 2013-04-26 18:56 YaLing 阅读(328) 评论(0) 推荐(0) 编辑
摘要: 由题目意思来看,既然是对称的路径,那么我们只需要把左上三角的值与右下三角的值加到左上三角上,然后计算从0,0到对称线上的点计算最短路,这样可以大大减少计算时间。那么存网格的时候可以用二维数组存放起来,以测试用例存放就是:221211211然后我们看第一条,(1,1)—>(1,2)—>(2,2)第二条... 阅读全文
posted @ 2013-04-26 15:29 YaLing 阅读(286) 评论(0) 推荐(0) 编辑
摘要: http://acm.nyist.net/JudgeOnline/problem.php?pid=523#include#include#include#includeusingnamespacestd;structpoint{inta,b,c,time;}p1,p2,p3;intA,B,C,t,m... 阅读全文
posted @ 2013-04-25 21:33 YaLing 阅读(172) 评论(0) 推荐(0) 编辑
摘要: 1#include2#include3#include4#include5usingnamespacestd;6inta[22],n;7intb[]={0,0,0,4,6,0,0,12,40,0,0,171,410,0,0,1896,5160,0,0,32757};89voidslove()10{1... 阅读全文
posted @ 2013-04-25 20:20 YaLing 阅读(204) 评论(0) 推荐(0) 编辑
摘要: #include <cstdio>#include <iostream>#include <cstdio>#include <ctime>using namespace std;int main(){ srand(time(NULL)); //以当前时间产生随机数种子 for(int i = 0; i < 100; ++i) printf("%d\n", rand()%10); //产生 0 ~ 9 的随机数(a + rand() % (b-a+1) 就表示a~b之间的一个随机数) while(1); return 0; 阅读全文
posted @ 2013-04-25 19:20 YaLing 阅读(166) 评论(0) 推荐(0) 编辑