提交记录 16547
提交时间 |
评测时间 |
2021-10-06 01:57:14 |
2023-09-03 19:41:54 |
#include <cstdio>
#include <algorithm>
int d[10];
// lexicographical_order
void lexicographical_order(const int size)
{
int tot = 1;
register int i, j, k;
for (i = 0; i < size; i++) d[i] = i+1, tot *= i+1;
while (--tot)
{
i = size - 2;
while (d[i] > d[i+1]) i--;
j = size - 1;
while (j != i) {
if (d[j] > d[i]) {
std::swap(d[j], d[i]);
break;
} else j--;
}
i++;
j = size - 1;
while (i < j) {
std::swap(d[i], d[j]);
i++; j--;
}
}
}
int main()
{
lexicographical_order(5);
return 0;
}
Compilation | N/A | N/A | Compile OK | Score: N/A | 显示更多 |
Testcase #1 | 4.91 us | 8 KB | Accepted | Score: 100 | 显示更多 |
Judge Duck Online | 评测鸭在线
Server Time: 2024-11-23 05:45:41 | Loaded in 1 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠