Shirlies
宁静专注认真的程序媛~
摘要: 参考http://blog.sina.com.cn/s/blog_622684e80100n3gz.html 阅读全文
posted @ 2012-02-21 11:59 Shirlies 阅读(167) 评论(0) 推荐(0) 编辑
摘要: 广搜无语,结构体竟然犯错,害我找问题……#include <iostream>#include <queue>using namespace std;typedef struct{char c1,c2;}node;node n1,n2,at;int dx[8]={-2,-1,1,2,2,1,-1,-2};int dy[8]={1,2,2,1,-1,-2,-2,-1};int main(){node m;int x,y;int vis[10][10];while(cin>>n1.c1>>n1.c2>>n2.c1>>n2.c2 阅读全文
posted @ 2012-02-20 21:41 Shirlies 阅读(263) 评论(0) 推荐(0) 编辑
摘要: 才开始搞杭电的搜索的题目(这一题算是第二道),首先看到这题,毫不客气的用了深搜,悲剧咯,栈溢出,网上搜了一看,晕,要广搜,好吧,第一次用stl的队列,写完了,样例过了,但是WA了,无语,真的没有发现什么错误啊,拿别人的代码看看,思路大致差不多啊,怎么啦,改了改又提交还是WA,不明所以,在研究这份代码的时候,忽然发现哪里错了,郁闷,貌似是习惯了c语言,把一切东西都定义在一堆,那个队列也定义在前面了,在进行下次数据测试的时候,那个队列并没有清空!#include <iostream>#include <cstring>#include <queue>using 阅读全文
posted @ 2012-02-20 20:11 Shirlies 阅读(884) 评论(0) 推荐(0) 编辑
摘要: 数学啊!http://apps.hi.baidu.com/share/detail/16843204代码就不贴了,这一题让我惭愧,不说了…… 阅读全文
posted @ 2012-02-20 00:02 Shirlies 阅读(251) 评论(0) 推荐(0) 编辑
摘要: 这一题起初我连题目都没有看懂,汗,貌似最近自己对题目的理解有点障碍啊,得多多看书了,最好拿本英文书阅读,泪崩啊……郁闷中,理解题目了,但是没有头绪,不知道这一题哪里是二分题目了,茫然中搜了题解http://www.cnblogs.com/newpanderking/archive/2011/08/24/2152576.html自卑啊,也明白了并不是学到了什么就一定会用!要灵活变化啊~~~#include "stdio.h"#include "math.h"#define pi acos(-1.0)//!!#define er 1e-6double are 阅读全文
posted @ 2012-02-19 21:03 Shirlies 阅读(610) 评论(0) 推荐(0) 编辑
摘要: 晕,这一题我是准备暴力的,但是这里给的数据有点大,那样是会TLE的,网上搜搜,无语啦,竟然可以这样来思考:合并前两个数组,然后再二分……#include "stdio.h"#include "stdlib.h"int li[505];int mi[505];int ni[505];int join[250005];int cmp(const void *a,const void *b){int *c,*d;c=(int *)a;d=(int *)b;return *c-*d;}int main(){int l,m,n;int s;int count=1; 阅读全文
posted @ 2012-02-19 17:07 Shirlies 阅读(554) 评论(0) 推荐(0) 编辑
摘要: 这一题摔的有点惨,为嘛?首先是题目看错了,还以为是数据范围的问题,改成__int64,总共wa了两次,在仔细看题目,汗……我应该取模的,好吧,取了模,还是Wa了,额……怎么了,网上翻了别人的代码,哦哦,数据范围有问题,刚才改的时候,又改回成int了,好了,a了。其实这一题蛮简单的,就是找规律……#include "stdio.h"#include "math.h"int main(){int T;__int64 n,k;scanf("%d",&T);while(T--){scanf("%I64d",& 阅读全文
posted @ 2012-02-19 15:33 Shirlies 阅读(458) 评论(0) 推荐(0) 编辑
摘要: 对这一题表示无语……#include "stdio.h"#include "math.h"int main(){int T;int n;scanf("%d",&T);while(T--){scanf("%d",&n);printf("%d\n",(int)pow(2,n)-1);}return 0;} 阅读全文
posted @ 2012-02-19 12:31 Shirlies 阅读(155) 评论(0) 推荐(0) 编辑
摘要: 先求导,在二分……#include "stdio.h"#include "math.h"#define er 1e-4double get_equ(double x){return 42*pow(x,6)+48*pow(x,5)+21*x*x+10*x;}int main(){int T;double y;double mid,left,right;scanf("%d",&T);while(T--){scanf("%lf",&y);left=0;right=100;mid=50;while(fabs 阅读全文
posted @ 2012-02-19 11:20 Shirlies 阅读(184) 评论(0) 推荐(0) 编辑
摘要: 基本的二分,但是我还是提交了几次,因为那个er开大了,超时了……#include "stdio.h"#include "math.h"#define er 1e-4//这里的er我起初开到了1e-7……超时了……int main(){int T;double n,t,u,d,a;scanf("%d",&T);while(T--){scanf("%lf",&n);n=n-6;if(n<0||n>(8*10000-100+3)*101*100){printf("No solutio 阅读全文
posted @ 2012-02-19 10:33 Shirlies 阅读(257) 评论(0) 推荐(0) 编辑