随笔分类 - 模板类
摘要:https://blog.csdn.net/qq_32265245/article/details/53046750?tdsourcetag=s_pcqq_aiomsg
阅读全文
摘要:#include #include using namespace std; int main() { //第一种定义方式 vector vec; //第二种定义方法,把n个长度的数初始化为0 vector vec(n,0); //第三种定义方法,是定义一个固定长度的数组 vector vec(100); //第四种是定义一个二维数组,但是...
阅读全文
摘要:#include #include #include #define ll long long using namespace std; ll pow_mod(ll a,ll b,ll mod){ ll ans = 1; a %= mod; while(b){ if(b&1){ ans = ans * a % mod; ...
阅读全文
摘要:#include #include using namespace std; void hanor(int src,int mid,int desk,int count){ if(count==1){ printf("%c -> %c\n",src,desk); return; } hanor(src,desk,mid,count-1);...
阅读全文
摘要:#include #include #define INF 65535 using namespace std; int vis[100][100]; //路径长度 int map[100][100]; //迷宫地图 typedef pair P; //节点坐标 P p; int dx[4] = {1,0,-1,0}; //四个方向 int dy[4] = {0,1,0,-1}; in...
阅读全文
摘要:#include using namespace std; int arr[5] = {5,4,1,3,6}; //待排序数组 void quick_sort(int left,int right){ int tmp = arr[left]; //找基准 if(left>=right){ //如果左边扫描大于右边扫描就结束 return; ...
阅读全文
摘要:最长递增子序列模板(1) 最长递增子序列模板2 最长公共子序列模板 最长公共上升子序列和模板
阅读全文
摘要:内置10进制转换各种进制的函数 函数原型:char *itoa(int value,char *string,int radix ); value是你想转化的数,radix 多少进制。 string的substr函数 s.substr(pos, n) pos是开始截取的位置,n是从那个位置开始要截取
阅读全文
摘要:#include #include #include #include using namespace std; int main() { string str1; string str2; int jw=0; int arr[10005]; int l=0; int i; int num; cin>>str1; cin>>...
阅读全文
摘要:#include using namespace std; int main() { int n,i,j; int jw; int gw=1; int a=0; int jc[10005]; jc[0] = 1; scanf("%d",&n); for(i=2;i=10){ jw += jc[j]/1...
阅读全文
摘要:int isPrime(int n) { if (n==2||n==3){ return 1; } if (n%6!=1&&n%6!= 5){ return 0; } for (int i=5;i*i<=n;i+=6){ if (n%i==0||n%(i+2)==0){ return...
阅读全文