在维基百科上看到了生成下一个排列的算法(这里)Find the largest indexksuch thata[k] 2 3 using namespace std; 4 5 const int MAXN = 1000; 6 int A[MAXN], n; //sequence to gen... Read More
设变量 a = 1, b = 2, 我们要交换两个变量的值, 当用异或交换两个值的时候会有一个小问题用位运算大概是这个样子的 1 #include 2 3 using namespace std; 4 5 void swap(int& a, int &b) { 6 a ^= b; 7 ... Read More