小墨在努力!!
吗了个b的。。。。。
摘要: #include <cstdio>#include <queue>using namespace std ;int dir[8][2] = { -2 ,-1 ,-2 ,1 ,-1 ,2 ,1 ,2 ,2 ,1 ,2 ,-1 ,1 ,-2 ,-1 ,-2} ;int obstacle[4][2] = { -1 ,0 ,0 ,1 ,1 ,0 ,0 ,-1} ;typedef struct coord{ int x ,y ,step;}coord ;bool map[100][100] ,visit[100][100] ;int p ,q ;int bfs(coord sta 阅读全文
posted @ 2012-09-25 20:41 小墨在努力!! 阅读(248) 评论(0) 推荐(0) 编辑
摘要: IntroductionWe often need some sort of data structure to make our algorithms faster. In this article we will discuss theBinary Indexed Treesstructure. According toPeter M. Fenwick, this structure was first used for data compression. Now it is often used for storing frequencies and manipulating cumul 阅读全文
posted @ 2012-08-01 20:15 小墨在努力!! 阅读(181) 评论(0) 推荐(0) 编辑
摘要: Source Code#include <stdio.h>#include <algorithm>using namespace std ;bool visit[65] ,judge ;int len[65] ,min_length ,stick_num ,num ,next[65] ;bool cmp(int a ,int b) { return a > b ;}void init() { judge = false ; sort(len ,len + num ,cmp) ; //从大到小排序 len[num] = -1 ; int pre = len[0] . 阅读全文
posted @ 2012-08-01 20:12 小墨在努力!! 阅读(166) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=1050Source CodeProblem: 1050 User: XXXMemory: 216K Time: 0MS Language: C++ Result: Accepted Source Code #include <stdio.h>int num[100][100] ,sum[100][100] ;//初始化sum数组void init(int n) { for(int i = 0 ; i < n ; i++) { sum[0][i] = 0 ; sum[1][i] = num[0... 阅读全文
posted @ 2012-07-21 13:26 小墨在努力!! 阅读(165) 评论(0) 推荐(0) 编辑
摘要: 1 #include <cstdio> 2 #include <string.h> 3 #include <string> 4 #include <algorithm> 5 using namespace std; 6 bool visitIs[30] ,judge; 7 int ans[6] ,N[26] ,total; 8 long long target ,sum; 9 void set(char *a)10 {11 int i ,len;12 for(i = 0 ;i < 30 ;i++)13 visitIs[i] = false; 阅读全文
posted @ 2012-04-14 19:33 小墨在努力!! 阅读(450) 评论(0) 推荐(0) 编辑
摘要: 母函数水过:View Code 1 #include <stdio.h> 2 #include <string.h> 3 long solve(int n) 4 { 5 int i ,j ,k; 6 long c[121] ,a[121]; 7 memset(a ,1 ,sizeof(a)); 8 for(i = 0 ;i <= n ;i++) 9 a[i] = 1;10 for(i = 2 ;i <= n ;i++) //控制多项式的个数11 {12 memset(c ,0 ,size... 阅读全文
posted @ 2012-04-02 20:54 小墨在努力!! 阅读(144) 评论(0) 推荐(0) 编辑
摘要: #include <stdio.h>__int64 num[5843];__int64 min(__int64 a ,__int64 b ,__int64 c ,__int64 d){ a = a > b ? b : a; c = c > d ? d : c; return a > c ? c : a;}void produce(){ int i1 = 1 ,i2 = 1,i3 = 1,i4 = 1 ,i; num[1] = 1; for(i = 2 ;i <= 5842 ;i++) { num[i] = min(num... 阅读全文
posted @ 2012-03-26 18:23 小墨在努力!! 阅读(444) 评论(0) 推荐(0) 编辑
摘要: #include <stdio.h>#include <string.h>int main(){ int n ,m ,k ,s ,t ,i ,j ,f[105][105] ,a[105] ,b[105]; while(scanf("%d %d %d %d",&n ,&m ,&k ,&s) != EOF) { memset(f ,0 ,sizeof(f)); for(i = 1 ;i <= k ;i++) scanf("%d %d",&a[i] ,&b[i]); for(j = 阅读全文
posted @ 2012-03-10 17:31 小墨在努力!! 阅读(164) 评论(0) 推荐(0) 编辑
摘要: 1 Source Code 2 3 Problem: 1887 User: XXX 4 Memory: 240K Time: 63MS 5 Language: C++ Result: Accepted 6 7 Source Code 8 #include <stdio.h> 9 int main()10 {11 int num[10000] ,total ,i ,j ,k ,Max ,max ,dp[10000] = {1};12 for(k = 1 ; ;k++)13 {14 total = -1 ,Max = 1;15... 阅读全文
posted @ 2012-02-26 11:30 小墨在努力!! 阅读(150) 评论(0) 推荐(0) 编辑
摘要: 感觉有点水啊,不过我怎么感觉自己没呢dp的思维啊 1 Source Code 2 3 Problem: 1088 User: XXX 4 Memory: 248K Time: 0MS 5 Language: C++ Result: Accepted 6 7 Source Code 8 #include <stdio.h> 9 #include <string.h>10 int num[102][102] ,dp[102][102];11 int slove(int i ,int j)12 {13 if(dp[i][j] != -1) return dp[i][j];.. 阅读全文
posted @ 2012-02-25 14:02 小墨在努力!! 阅读(181) 评论(0) 推荐(0) 编辑