随笔分类 - 算法竞赛入门
算法竞赛入门经典(第2版) -刘汝佳
摘要:没看解答敲了一遍,发现自己题目的理解能力有点差 虽然能实现四叉树的合并但并不能算出像素:-( 然后看答案后又敲了遍
阅读全文
摘要:1 #include 2 #include 3 #include 4 5 using namespace std; 6 7 int const maxn=10000; 8 int sum[maxn]; 9 10 11 void built(int p) 12 { 13 int v; 14 cin>>v; 15 16 if(v==-1)...
阅读全文
摘要:1 #include 2 #include 3 4 using namespace std; 5 6 const int maxn=100000; 7 int n; 8 int postorder[maxn],inorder[maxn]; 9 int lh[maxn],rh[maxn]; 10 11 12 bool read_list(int* a) 13 { 14...
阅读全文
摘要:1.指针实现 2.数组实现 书上的接口写的太棒了,换了种实现方式,代码基本上没改,比我自己写的接口不知道高到哪里去了.
阅读全文
摘要:1 #include 2 #include 3 4 using namespace std; 5 6 int btr[1<<20]; 7 8 9 int main() 10 { 11 int D,I; 12 13 while(scanf("%d%d",&D,&I)==2) 14 { 15 m...
阅读全文
摘要:6-4 自己先敲了一遍虽然可以完成书上的功能但是漏洞百出 1 #include <iostream> 2 #include <cstdio> 3 #include <cstring> 4 5 using namespace std; 6 7 const int maxn=100000+100; 8
阅读全文
摘要:1 #include 2 #include 3 #include 4 5 using namespace std; 6 7 vector vt; 8 stack st; 9 10 int main() 11 { 12 vt.clear(); 13 14 int n; 15 cin>>n; 16 17 for(int i...
阅读全文
摘要:1 #include 2 #include 3 #include 4 5 using namespace std; 6 7 struct BigInteger 8 { 9 static const int BASE=100000000; 10 static const int WIDTH=8; 11 12 vector...
阅读全文
摘要:稍微测试了一下cin的用法和字节流的用法 5-3 5-4 5-5 5-6 5-7
阅读全文
摘要:例题4-3 这里最要注意的是13行的移动一位的操作,p = (p+d-1+n) % n+1 是为了在1-n 之间循环 如果是在0 -n 之间循环应该写为 p=(p+d+n)%n 例题 4-4
阅读全文
摘要:3-2 Molar_Mass 刚开始纠结于不用数组,结果各种程序漏洞,改成用数组后不仅逻辑更加清晰也更好写了 3-3 Digit Counting 用sprintf可以写出很简介的代码 这里有篇关于sprintf用法的文章,感觉很有用
阅读全文
摘要:1 #include 2 3 int main() 4 { 5 int c,q=1; 6 7 FILE *fin; 8 fin=fopen("TeX.out","r"); 9 10 while((c=fgetc(fin))!=EOF) 11 { 12 if(c=='"') 13 { 14 ...
阅读全文
摘要:1 #include 2 #include 3 4 #define maxn 20 5 6 int a[maxn][maxn]; 7 8 int main() 9 { 10 memset(a, 0, sizeof(a)); 11 12 int x = 0; 13 int y = maxn - 1; 14 int tot = a[x][y]...
阅读全文
摘要:习题2-1 习题2-2 2-3 2-4所谓陷阱就是溢出注意注释部分的内容 2-5
阅读全文

浙公网安备 33010602011771号