Shirlies
宁静专注认真的程序媛~
上一页 1 ··· 9 10 11 12 13 14 15 16 17 ··· 21 下一页
摘要: 一题如此基础的题目,搞了那么久,晕。。。不过有很多细节错误自己改过来了,给自己鼓鼓掌^_^求幂的时候要用longlong型的,可是为什么啊?x的值根本就不可能比65000大啊,每次都取模啊,求反例。。。。。。还有判断素数要在前,刘汝佳先生说过&&是短路来着。。。。。。View Code 1 #include <cstdio> 2 #include <cstring> 3 #include <cmath> 4 5 int prime[65002]; 6 int n; 7 8 void is_prime() 9 {10 int m = sqrt( 阅读全文
posted @ 2012-04-13 20:27 Shirlies 阅读(637) 评论(1) 推荐(0) 编辑
摘要: 不错的一题,需要极角排序,看了别人的代码做的。。。。。。计算几何啊~~~View Code 1 #include <cstdio> 2 #include <cstring> 3 #include <cmath> 4 #include <algorithm> 5 6 const double er = 1e-8; 7 struct point 8 { 9 int index;10 int x,y;11 }p[100];12 int n;13 int res;14 15 int dis(point a,point b)16 {17 return sq 阅读全文
posted @ 2012-04-12 10:43 Shirlies 阅读(241) 评论(0) 推荐(0) 编辑
摘要: 晕,最基本的dp题,最长公共子序列。。。。。。竟然没有考虑到空格,衰衰地wa了几次。。。。。。View Code 1 #include <cstdio> 2 #include <cstring> 3 #include <algorithm> 4 5 const int maxn = 1010; 6 int dp[maxn][maxn]; 7 char s1[maxn]; 8 char s2[maxn]; 9 10 int main() 11 { 12 while(gets(s1) != NULL) 13 { 14 gets(s2); 15 int len1 阅读全文
posted @ 2012-04-07 16:20 Shirlies 阅读(401) 评论(0) 推荐(0) 编辑
摘要: (~ o ~)~zZ最长子序列。。。。。。View Code 1 #include <cstdio> 2 #include <cstring> 3 #include <algorithm> 4 using namespace std; 5 6 struct box 7 { 8 int index; 9 int dm[12]; 10 }b[40]; 11 int num,dim; 12 int ins,maxn; 13 int dp[40]; 14 int record[40]; 15 int ans[40]; 16 17 bool cmp(const box 阅读全文
posted @ 2012-04-07 15:49 Shirlies 阅读(283) 评论(0) 推荐(0) 编辑
摘要: 这一题题意理解起来有点困难,汗,这个对题目意思解释比较详细,我是看了这个题目解释才做出来的http://www.byywee.com/page/M0/S259/259491.htmlView Code 1 #include <cstdio> 2 #include <cstring> 3 4 int in[30]; 5 int right[30]; 6 int dp[30]; 7 int b[30]; 8 9 int main() 10 { 11 int n; 12 int a; 13 scanf("%d",&n); 14 for(int i 阅读全文
posted @ 2012-04-07 11:23 Shirlies 阅读(343) 评论(0) 推荐(0) 编辑
摘要: 痛苦啊。。。折磨我好长时间啊,不过总算把错误给搞出来了,也学到了一点东西。。。。。。哎,可是这折磨貌似太长了。。。。。。。。。。。。。。。。。。。。首先用的是动态邻接表,起初WA,之后MLE,晕,不过知道了动态邻接表为什么会MLE了:起初分配的内存没有释放,而且题目说有大量的输入,这样就会越积越多。。。然后就是用vector,也是一直WA,郁闷,和网上的代码对比之后,改了一通,A了之后,忽然知道哪里错了,就是当是同一个点的时候,那个vis数组要放在lca函数的开头,如果放中间,因为我是首先判断有没有答案的,所以如果是同一个点的话,如果vis放中间的话,同一个点是无法判断的它之间的距离的。。。。 阅读全文
posted @ 2012-03-31 22:08 Shirlies 阅读(837) 评论(0) 推荐(0) 编辑
摘要: 哈哈,让我把错误给找出来了,c++ 31ms,(*^__^*) 嘻嘻……有点成就感,也有点烦闷,单步调试终于把错误搞出来了,可是这个是递归诶,单步调试,我的时间啊。。。。~~~~(>_ 2 #include 3 4 const int maxn = 40010; 5 6 struct node 7 { 8 int tag; 9 int w; 10 struct node *next; 11 }*temp; 12 13 struct head 14 { 15 struct node *next; 16 }; 17 head pnt[maxn... 阅读全文
posted @ 2012-03-27 17:23 Shirlies 阅读(242) 评论(0) 推荐(0) 编辑
摘要: 一道简单的树状数组,但是存在坑爹的问题。。。是我自己的问题。。。。。。~~~~(>_<)~~~~首先说一下输出,输出案例,是在输入那些阵营的人数之后在输出(再次表示不满,acm就一定要有案例输出吗,这个问题输出错了竟然判wa,害人不浅,我根本就没有想到这里会出错,浪费精力。。。~~~~(>_<)~~~~ )第二,我判别了一下人数删除时是否符合要删除的数量时就错了。。。。。。有问题吗?难道你要别人减去的人比本来的人数还要多。。。。。。你很喜欢负债吗?(~ o ~)~zZView Code 1 #include <cstdio> 2 #include <c 阅读全文
posted @ 2012-03-25 11:28 Shirlies 阅读(362) 评论(0) 推荐(0) 编辑
摘要: O(∩_∩)O哈哈~二维树状数组被我搞出来了,太开心了,第一道二维树状数组,(~ o ~)~zZ虽然中途还是出问题了,就是S询问的时候我没有考虑坐标的大小问题,还是搜了别人的代码才知道的,看来自己考虑问题不周到,~~~~(>_<)~~~~View Code 1 #include <cstdio> 2 #include <cstring> 3 #include <algorithm> 4 5 int book[1005][1005]; 6 int size = 1002; 7 void insert(int x,int y,int num) 8 { 阅读全文
posted @ 2012-03-23 22:06 Shirlies 阅读(288) 评论(0) 推荐(0) 编辑
摘要: (顺便说一下,前面的一道Box Relations,这一题我是根据别人的代码写的,构造那个图很难的说,我也是品味了好久才品出真味来的。http://blog.csdn.net/me4546/article/details/6576517)huffman编码是也一用到指针就容易出错,~~~~(>_<)~~~~ 该死的,是我对指针没有理解清楚吗?~_~View Code 1 #include <cstdio> 2 #include <cstring> 3 #include <queue> 4 using namespace std; 5 6 stru 阅读全文
posted @ 2012-03-22 13:24 Shirlies 阅读(315) 评论(0) 推荐(0) 编辑
上一页 1 ··· 9 10 11 12 13 14 15 16 17 ··· 21 下一页