终于到了shared ptr 首先看一下std::make_shared 可能有人不知道stdpair是什么,接下来的例子是和stdpair有关系的, first和second是第一个成员和第二个成员,然后我们可以发现,第一个first和第二个second竟然可以不一样 // make_pair e ...
分类:
其他好文 时间:
2021-01-08 11:22:07
阅读次数:
0
显示百分比 import sys import time n = 1 while n <= 100: sys.stdout.write('{}{:.0f}%\r'.format('*' * n, float(n / 100) * 100)) if n == 100: sys.stdout.write ...
分类:
编程语言 时间:
2021-01-08 10:50:22
阅读次数:
0
1 #define IO std::ios::sync_with_stdio(0) 2 #include <bits/stdc++.h> 3 using namespace std; 4 #define mk make_pair 5 #define pb push_back 6 const int ...
分类:
其他好文 时间:
2021-01-06 11:49:40
阅读次数:
0
#include<iostream> #include<vector> using namespace std; vector<char>post,in; vector<char>level(100000,-1); in N; void ergodic(int root,int start,int ...
分类:
编程语言 时间:
2021-01-05 11:40:19
阅读次数:
0
前面我们讲了一下冒泡排序,原理比较简单,但是我们发现他的排序比较慢,需要不断的进行数据的交换。然后我们来讲一讲选择排序,他不用一直进行数据的交换,他会找到最小的那个数,放在最左边,跟冒泡排序的不同之处,冒泡是两个数之间的比较,大的那个数放到右边。 选择排序 选择排序的原理也比较好理解,比如我们有n个 ...
分类:
编程语言 时间:
2021-01-05 11:29:13
阅读次数:
0
#include <iostream> #include <cstdio> #include <cmath> using namespace std; int b; double a,s; void fun(double x,int d)//引入递归深度 { if(d==b) return; s=s ...
分类:
其他好文 时间:
2021-01-05 10:58:51
阅读次数:
0
#include<bits/stdc++.h> using namespace std; int n; void mysort(int a[],int l,int r)//自己写的快排 { int mid=a[(l+r)/2];//找中间的数进行2分 int i=l,j=r; do{ while(a ...
分类:
编程语言 时间:
2021-01-05 10:39:05
阅读次数:
0
给定一个整数n,将数字1~n排成一排,将会有很多种排列方法。 现在,请你按照字典序将所有的排列方法输出。 #include<bits/stdc++.h> using namespace std; int n,p[10]; bool k[10]; void out() { for(int i=1;i< ...
快速幂运算 HDU2035 求 http://acm.hdu.edu.cn/showproblem.php?pid=2035 题目是很简单的,因为b也不大所以时间复杂度为n的算法也能ac #include <iostream> using namespace std; int a, b; int p ...
分类:
其他好文 时间:
2021-01-01 12:58:37
阅读次数:
0
#include<iostream>using namespace std;int main(){ int oneInt =1; int & ref=oneInt; const int &refc=oneInt; ref=2; cout<<"oneInt="<<oneInt<<","<<"ref=" ...
分类:
其他好文 时间:
2021-01-01 12:35:39
阅读次数:
0