头像

万ಡωಡ




离线:10天前


最近来访(0)


include[HTML_REMOVED]

using namespace std;

include[HTML_REMOVED]

include[HTML_REMOVED]

include[HTML_REMOVED]

int n;
const int N = 16;
int st[N];

void dfs(int a)
{
if(a > n )
{
for(int i = 1; i <= n; i++)
{
if(st[i] == 1)
{
printf(“%d “,i);
}
}
printf(“\n”);
return;
}
st[a] = 1;
dfs(a+1);

st[a] = 2;
dfs(a+1);

}

int main()
{
cin >> n;
dfs(1);

system("pause");

return 0;

}



活动打卡代码 AcWing 785. 快速排序

万ಡωಡ
5个月前
quick_sort(int q[], int l, int r)
{
    if(l==r) return;
    int x = q[l+r>>1],i = l-1,j = r+1;
    while(i < j)
    {
        do i++;while(q[i] < x);
        do j--;while(q[j] > x);
        if(i < j)swap(q[i],q[j]);
    }
    quick_sort(q,l,j);quick_sort(q,j+1,r);
}
//这里填你的代码^^
//注意代码要放在两组三个点之间,才可以正确显示代码高亮哦~