- 博客(46)
- 收藏
- 关注
原创 HDU 4452
简单模拟题0.0就是处理麻烦点点而已,还有题目难懂#includeusing namespace std;int f[4][2]={-1,0,0,-1,1,0,0,1};//0:N 1:W 2:S 3:Eint n;int x_1,y_1,x_2,y_2;int dis_1,speed_1,time_1;int dis_2,speed_2,time_2;inline i
2013-04-15 18:47:29
992
原创 单片机——数码管
群上有人问的问题,那时候听不懂在讲什么,我想对于我一个初学者应该回答不上,后来那人问了好多遍呢。。。。我看不下去了,后来问他是什么问题呢?他说是数码管的,兮兮,一听,我觉得我能会的,虽然一个学期才写了两个代码,但是我觉得思路不是问题,最基本是我得要懂硬件。后来他说了好几遍,我才知道他到底在讲什么,我归纳起来就是 数码管显示1-----21-----321-----4321-----54321---
2013-01-26 18:38:13
1169
原创 poj 1579
简单开始,我要拿下这些题目这题选的比较水,慢慢来#includeusing namespace std;int re[21][21][21];int run(int a,int b,int c){ if(a<=0||b<=0||c<=0) return re[0][0][0]; if(a>20||b>20||c>20) { if(re[20][20][20]) r
2012-12-16 20:50:38
702
原创 HDU 2716 水题
很水的题目,郁闷的是我题目看错#include#includeusing namespace std;int key[26];void Inti(char ch[]){ int i; for(i=0;i<26;i++) { key[i]='a'+i; } int len=strlen(ch); for(i=0;i<len;i++) { if(ch[i]>='
2012-12-12 20:11:56
547
原创 对于我的问题,老师给出的答案
很简单的一个问题,不过老师表扬了一下我,兮兮//主要是精度问题,double精度有限(15-16位),超过精度位会自动进位,所以出了问题//看一下以下代码,输出为//0 123456790 123456789#include using namespace std;int main(){ int b=123456789; int c1,c2,c3; c1=0.9999
2012-12-10 18:33:35
580
原创 HDU 1969
二分题目,挺简单的~~#include#include#includeusing namespace std;double pie[10001];int n,m;//n表示蛋糕的个数,m表示人数const double PI=acos(-1.0);inline bool Jude(double mid){ int i; int sum=0; for(i=0;i<n;
2012-12-09 20:26:50
693
原创 我的大三
大三了,好忙好忙,自己的专业很多课落下了,平时也不知道自己在干嘛。。总喜欢自己慢慢的学习,总喜欢有人能够引导,陪我一起学习。。本来不打算发展自动化专业了,所以这个学期也没有去电子设计那边,我想自学c++,windows编程,可是我感觉我好无力,什么都要自学,也不知道怎么开头学,一开始直接MFC,就是死路一条。跳跃太大了,开始还在找头文件main在哪儿。。那时候c++还没有怎么看,只是平时编程的时候
2012-12-09 01:07:02
678
1
原创 HDU 4190 二分
不多说了,二分题目,都是别人提示了,我喜欢自己想出来,不过刚刚看到这题,就想到这个方法了,思路没定行,出题人就喊着二分了,╮(╯▽╰)╭ #include using namespace std;int city[500001];int n,m;inline bool Jude(int mid){ int sum=0; for (int i=0
2012-12-09 00:25:57
821
原创 HDU 1133
这道题目我用dp过了,转化了思路,把50元准换为1步的长度,把100元转换成2步的步长,总长度为n+2*m这个思路也不知道就蹦出来了,嘿嘿,很特别吧,兮兮~~开始的时候直接超内存了开了1200w+的数组,最后压缩成300w+ ,进制提高了可能速度不是很快31ms,但还是挺有成就感,利用了大数乘大数 #includeusing namespace std;//用到大
2012-12-07 18:34:00
1274
原创 HDU 2065
很久很久没有做递推题目了,就是简单的递推,不是很难的,不知道怎么了,最近头脑爆发,感觉递推很顺手了,就连老师说曾经说有点难读的递推都过了,很久前我是过不了的,兮兮,脑袋变的好使了 递推公式:f[n][0] = 2 × f[n-1][0] + f[n-1][1] + f[n-1][2]; f[n][1] = 2 × f[n-1][1] + f[n-1][0] + f[n-1][3
2012-12-05 19:37:33
1304
原创 HDU 4302
在0~n长的管子里面吃蛋糕,0操作代表在某个点放蛋糕,1代表吃掉离他最近的蛋糕,当距离狗相同时,吃原来方向的蛋糕,要求求步数,起始点在0.想不到线段树呢,,大神一提醒最大值和最小值,我才知道怎么用线段树解决,,表示题目看不懂呢,吃原来的方向,,,题目看不懂,呜呜 #includeusing namespace std;const int MAX=100001;const
2012-11-25 15:44:45
579
原创 HDU 1698
线段树,手痒,又写了一题,我的作业,我作业落下好多了,就是不想安静下来看书 #includeusing namespace std;const int MAX=100001;struct T{ int l,r,m,va;}tree[MAX*3];void Build_tree(int root,int l,int r){ tree[root]
2012-11-24 16:15:38
466
原创 POJ 3225
U:把区间[l,r]覆盖成1I:把[-∞,l)(r,∞]覆盖成0D:把区间[l,r]覆盖成0C:把[-∞,l)(r,∞]覆盖成0 , 且[l,r]区间0/1互换S:[l,r]区间0/1互换刚刚做的时候没有理解,后来才知道(2,3)区间也是可以的,不是一个点,而是区间,因为输入都是整数,所以,(2,3)扩大为(4,6),这样[5,5],就可以来取代(2,3)这种情况继续写实验
2012-11-24 13:54:32
498
转载 无向图匹配的带花树算法
源网址http://fanhq666.blog.163.com/blog/static/8194342620120304463580/在北京冬令营的时候,yby提到了“带花树开花”算法来解非二分图的最大匹配。于是,我打算看看这是个什么玩意。其实之前,我已经对这个算法了解了个大概,但是。。。真的不敢去写。有一个叫Galil Zvi的人(应该叫计算机科学家),写了篇论文:
2012-11-20 19:34:27
1092
原创 ACdream 1028
这里开始一直超时,后来看了公式,就发现自己傻了C[k]=(A[1]+A[2]+⋯+A[k])⋅B[k]+(B[1]+B[2]+⋯+B[k])⋅A[k]−A[k]⋅B[k]注意long long/************************************************************** Problem: 1028 User: yp04
2012-11-19 18:21:59
450
原创 ACdream 1024
bfs可以过的,只是我太粗心了,把num写成step了,然后一直错,找了2个多小时,真心好郁闷,害的后来没心情做题目了/************************************************************** Problem: 1024 User: yp0408100207 Language: C++ Result: Ac
2012-11-19 14:08:07
912
原创 ACdream 1022
这题我开始看的时候没思路,仔细想了想想到怎么做了,因为n是奇数个,所以0和1的个数一定是不同的第一次提交的时候没有check验证,不过居然过了,后来大神看了我的代码,就发现我的错了例如当出现某两个数是10 、 01时候,我的代码会将10、 01 和 00 、11混淆,水过了,现在修改了下,没有问题了只能说我思路不严密,呜呜,真佩服大神/***********************
2012-11-19 11:03:37
900
原创 HDU 1757
[a9,a8,a7,…,a0]*|f(0) 1 0 0,0,0,0,0,0,0||f(1) 0 1 0,0,0,0,0,0,0||f(2) 0 0 1,0,0,0,0,0,0||f(3) 0 0 0,1,0,0,0,0,0||f(4) 0 0 0,0,1,0,0,0,0||f(5) 0 0 0,0,0,1,0,0,0||f(6) 0 0 0,0,0,0,1,0,0|
2012-11-06 10:31:59
3723
原创 HDU 3829
就是建立图的问题,根据两个小朋友喜欢或不喜欢,找不出不可以呆在一起的小朋友,然后最大匹配,刚刚接触的时候不会做,进度太慢了 #include using namespace std;int n,m,k;int dog[102][502],dog_num[102];//讨厌小狗的小朋友,dog_num[i]记录dog[i][]小朋友的数量int cat[102]
2012-10-26 18:31:36
980
原创 poj 3041
//相关知识点¥ 最小覆盖: 最小覆盖要求用最少的点(X集合或Y集合的都行)让每条边都至少和其中一个点关联。可以证明:最少的点(即覆盖数)=最大匹配数 M¥ 简单的证明如下:¥ (1)M个是足够的。只需要让它们覆盖最大匹配的M条边,则其它边一定被覆盖(如果有边e不被覆盖,把e加入后得到一个更大的匹配)¥ (2)M个是必需的,仅考虑形成最大匹配的这M条
2012-10-24 20:02:13
611
原创 poj 2424 不是dp是水题
1 0 008:00 108:10 208:20 2答案居然是3!!!!题意都理解错了#include#includeusing namespace std;int table1[101],table2[101],table3[101];int main(){ char time[10]; int a,b,c,num; int sum; while(sc
2012-10-08 11:56:30
551
转载 优先队列
#include#include#include#includeusing namespace std;struct cmp1{ bool operator () (int &a, int &b) { return a > b ; // 从小到大排序,值 小的 优先级别高 }};struct cmp2{
2012-07-22 13:42:05
308
转载 KMP与最小覆盖子串
我对KMP的一些理解(lyp点拨的):pre[i](或next[i])的实质是串str[1..i]的最长且小于i的“相等前、后缀”分别为str[1..pre[i]](前缀)与str[(i-pre[i]+1)..i](后缀),通俗讲就是:使str[1..i]前k个字母与后k个字母相等的最大k值。KMP算法详解可见:http://blog.youkuaiyun.com/fjsd155/article/de
2012-07-16 19:59:41
338
原创 HDU 1789
#include#includeusing namespace std;struct N{ int len; int work[1001];}day[1001];bool cmp(int a ,int b){ return a>b;}int main(){ int t,n,i,num[1001],temp[1001],sum,j,M_day; scanf(
2012-07-03 10:39:12
1068
1
原创 HDU 2546
#include//写的有点出格#includeusing namespace std;int dp[1002],a[1002];int Max(int a,int b){ if(a>b) return a; return b;}int main(){ int n,i,j,vo,MAX,temp,tempp,b,k; while(scanf("
2012-05-18 08:53:03
823
原创 分苹果
Description有n个人排成一队,他们都有一个值,如果这个值是个整数xi,表示他有多余的xi个苹果,如果是个负数,表示他想要xi个苹果,有多余苹果的人要把苹果给想要苹果的人,使得每个人的值都变为0,每移动一个苹果给一个人都要花费一个单位的工作量,求完成任务的最小的任务量。Input有多组测量数据,先输入一个数T,表示有T组数据,然后输入一个n,表示有n个人,然后是n个人的值。
2012-05-09 13:21:39
508
原创 石头剪刀布
石头剪刀布1TimeLimit: 1 Second MemoryLimit: 32 MegabyteDescription放寒假了,x一个人在家很无聊。于是他就想出了一种新的石头剪刀布玩法(单机版的哦)。玩法如下:S代表石头,J代表剪刀,B代表布。赢得一分,平不得分,输扣一分。进行n次游戏,而且对手每次游戏出的什么都是已知的。但是自己只能出a次S,b次J和c次B(a,b
2012-05-08 20:50:40
845
原创 HDU 3415
#includeusing namespace std;int sum[200001];int a[100001];int que[200001];int run(int head,int tail,int m){ int st=head+1; int en=tail; while(st<en) { int min=(st+en)/2; if(sum[que[min
2012-05-03 20:59:13
656
原创 HDU 1003
用了二分+模拟队列,这个方法比较复杂#includeusing namespace std;int sum[100002];int que[100002];int main(){ int Max,tt=1; int t,n,m,i,tail,st,en,mm1,mm2; scanf("%d",&t); while(t--) {
2012-05-03 15:48:48
503
原创 zoj 3600
#include#include#includeusing namespace std;int t;double a,b;double run1(){ return a*2+b*3+t*2.0/5.0;}double run2(){ return a*2.5+3.75*b+t*2.5/4.0;}int sw(double a){ if((a-(int)a)>
2012-04-16 19:51:56
1028
原创 zoj 3610
很水的题目,但是没发现之前,打了很长的代码#include#include#includeusing namespace std;int main(){ int t; string str1,str2,str; scanf("%d",&t); while(t--) { cin>>str1>>str2>>str; cout<<str2; printf(" will
2012-04-16 19:27:32
985
原创 zoj 3607
这题当时比赛的时候以为是dp,以为客人走了还会回来==!#include#includeusing namespace std;int main(){ int pi[1001],ti[1001]; double temp,Maxtime,Max,Time; int t,n,i,sum; scanf("%d",&t); while(t--) { scanf("%d",&
2012-04-16 18:59:27
1311
原创 zoj 3609
比赛的时候卡在这里,都是我没有把题目看懂,m=1的情况没考虑好,直接当不存在处理了==下面给一种暴力法不过时间也是很快的#include#includeusing namespace std;int t;int main(){ int t,a,m,aa,ans,mm,i; scanf("%d",&t); while(t--) {
2012-04-15 18:45:53
751
原创 zoj 3203
题目 http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=3366三分法#include#include#includeusing namespace std;double H,h,D;double cal(double x){ return (h-x)*D/(H-x)+x;}int main
2012-04-13 13:28:58
1085
转载 算法艺术与信息学竞赛的相关题目
一.动态规划参考资料:刘汝佳《算法艺术与信息学竞赛》《算法导论》推荐题目:http://acm.pku.edu.cn/JudgeOnline/problem?id=1141 简单http://acm.pku.edu.cn/JudgeOnline/problem?id=2288 中等,经典TSP问题http://acm.pku.edu.cn/Judge
2012-04-13 09:39:15
2005
原创 zoj 2972
题目 http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=2972#include#include#includeusing namespace std;int Min(int a,int b){ if(a>b) return b; return a;}int main(){ map mi[2];
2012-04-11 16:36:53
455
原创 zoj 3212
很简单的题目,不要想多就行#include#includeusing namespace std;int main(){ int num[16][16]; int t,sum,n,m,j,k,i; scanf("%d",&t); while(t--) { scanf("%d%d%d",&n,&m,&k); for(i=0;i<n;i++) { for(
2012-04-10 19:36:01
546
原创 zoj 3211
#include#include#include#includeusing namespace std;struct Node{ int ai,bi;}tree[260];bool cmp(Node a, Node b){ if(a.bi==b.bi) return a.ai>b.ai; return a.bi<b.bi;}int Max(int a,int
2012-04-10 18:44:43
521
原创 zoj 3204
最小生成树Connect themTime Limit: 1 Second Memory Limit: 32768 KB You have n computers numbered from 1 to n and you want to connect them to make a small local area network (LAN). All con
2012-04-09 14:56:53
458
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人