随笔分类 - 练题题库
看懂了不代表能写出来, 能写出来不代表自己会了. 自己写和练题是必修课, 不要跳过任何一步
摘要:就是那个位运算,,,,,我又想多了emmmmm' 其实不同的位对应不同的递归而已 那个& 别弄错逻辑 如果有,就不能走!!! 1 #include<iostream> 2 #include<cstdio> 3 #include<cstring> 4 5 using namespace std; 6
阅读全文
摘要:今天发现很少写dfs.. dfs主要思想是递归 bfs主要靠队列 先说一下这个题我被阻了半个小时的地方: 1读数一定要注意scanf的吃回车 2注意数据类型为char,判断时是'0' dfs: #include <iostream> #include <string> #include <strin
阅读全文
摘要:用的递推 首先要注意需要排序(结构体排序用sort+<的重载) 其实又开了一个数组用来存数...只不过结构体排序能方便很多 1 #include <iostream> 2 #include <string> 3 #include <string.h> 4 #include <vector> 5 #i
阅读全文
摘要:这个题真是当时想麻烦了,,,感谢LLdl 提供的题解 其实一个很重要的点就是,如果后面的玩意翻转了偶数次,那就跟没变一样.如果是奇数次就取反. 怪我天真,第一反应就去位运算去了,,,,哪有那么复杂诶 害,,,,,,,,dl就是厉害
阅读全文
摘要:#include <iostream> #include <string> #include <string.h> #include <vector> #include <time.h> using namespace std; char a[110],b[110]; int dp[110][110
阅读全文
摘要:我看以前写过一个最长不下降,但是感觉可能没有那么好理解emmmm 下面这个是从正序寻找的emmmm 先来一个WA代码,我给写了WA的具体行数,看看其他行其实可以看出它的思路 第二个代码是AC的 1 #include <iostream> 2 #include <string> 3 #include
阅读全文
摘要:记录一下--一个名叫vj的地方把我的回溯代码一直wa,,, 逼我现学位运算~~~~ #include <iostream> #include <string> #include <string.h> using namespace std; long sum = 0, upperlim = 1; v
阅读全文
摘要:冻龟之前 先看地龟 1 // 2 // Created by snnnow on 2020/7/23 3 // 4 //递归算法,除了慢其实还好 5 #include<iostream> 6 #include<stdio.h> 7 #include<stdlib.h> 8 #include<time
阅读全文
摘要:好久真的是好久没有做dp的问题了(QWQ)(我有学过这玩意???) 诶,人生呐! 今天来一个动归~ 顺便可以回顾一下dfs. 这个题我觉得审题也非常重要 小可爱dp: 1 #include <bits/stdc++.h> 2 using namespace std; 3 int f[201],n,i
阅读全文
摘要:#include<iostream> #include<stdio.h> #include<stdlib.h> #include<time.h> #include <queue> using namespace std; int N=0; int ax[8]={0,0,1,-1,1,1,-1,-1}
阅读全文
摘要:1 /* 2 * 换行好烦人呀! 3 */ 4 #include <iostream> 5 #include <map> 6 #include <string> 7 using namespace std; 8 map<string,map<string,int>> m; 9 int N; 10 i
阅读全文
摘要:现在看题有种感觉:只闻其名,不知其所云. 比如这个归并. 来吧来吧不多说了啊啊 1 #include <iostream> 2 #include <set> 3 #include <cstring> 4 5 using namespace std; 6 int a[10]={1,2,6,3,4,7,
阅读全文
摘要:1 #include <iostream> 2 #include <algorithm> 3 4 using namespace std; 5 int a[100]; 6 int binarysearch(int a[],int size,int att){ 7 sort(a,a+size);//一
阅读全文
摘要:....又是以前虐过我的期末习题..哪里摔倒就哪里爬起来吧 1 #include<iostream> 2 #include<math.h> 3 #define N 1e-3 4 using namespace std; 5 6 bool IsZero(double a){ 7 return abs(
阅读全文
摘要:题外话: 某天晚上梦见更了五六篇博客而不知疲惫. 如果这是现实该多好啊哈哈哈!美梦成真吧! 中项表达式就是最普通的表达式.也是几个小定义来回递归.这个题在去年期末上机题中出现过,但是比这个还有难一些. 呜呜呜,去年的我啥都不会(当然现在也是),为难我干什么呀!!!! 解: 1 #include <i
阅读全文
摘要:挺简单的代码吧,,,就是那个return ...... 1 #include <iostream> 2 using namespace std; 3 int n; 4 void hanoi(int n,char src,char mid,char des){ 5 if(n==1){ 6 cout<<
阅读全文
摘要:1 /*可以用回溯,但是我已经不太熟悉回溯了!!!!!!!!呜呜呜 2 * 3 */ 4 #include <iostream> 5 #include <math.h> 6 using namespace std; 7 /* 8 * 这个地方我确实没有想到 9 * 我不知道怎么判断两个符号的作用对象
阅读全文
摘要:// // #include <stdio.h> /*可以用回溯,但是我已经不太熟悉回溯了!!!!!!!!呜呜呜 * */ #include <iostream> #include <math.h> using namespace std; int a[9]={0}; //bool b[100]={
阅读全文
摘要:1 #include <iostream> 2 #include<string.h> 3 using namespace std; 4 char Lleft[3][100]; 5 char Lright[3][100]; 6 char result[3][100]; 7 bool wight(cha
阅读全文