Algorithm 常用总结

  1. max()
  2. min()
  3. abs()
  4. swap()
  5. reverse(it1, it2)
  6. next_permutation() 得到下一个全排列
  • 实例:
int main(){
	int a[3] = "1, 2, 3";
	do{
		cout << a[0] << a[1] << a[2];
	}while(next_permutation(a, a+3);
	return 0;
}
  1. fill();
fill(a, a+5, x);
fill(G[0], G[0] + maxn * maxn, x);
  1. sort();
  2. lower_bound() & upper_bound();
    lower_bound(): >=
    upper_bound(): >
发布了271 篇原创文章 · 获赞 5 · 访问量 6532

猜你喜欢

转载自blog.csdn.net/qq_42347617/article/details/104088900
今日推荐