标签:mes main span prim bsp nbsp include list ret
#include<iostream> #include<algorithm> using namespace std; void Prim(int list[],int n) { int num=1,a=0,b=0; for(int i=n;i>0;i--) num*=i; while(num--) { for(int i=0;i<n;++i) cout<<list[i]<<" "; cout<<endl; for(int i=n-1;i>0;--i){ if(list[i-1]<list[i]) { a=i-1; break; } } for(int j=n-1;j>a;--j){ if(list[j]>list[a]) { b=j; break; } } swap(list[a],list[b]); sort(list+a+1,list+n); } return; } int main() { int list[]={1,2,3,4}; Prim(list,3); return 0; }
标签:mes main span prim bsp nbsp include list ret
原文地址:https://www.cnblogs.com/coodyz/p/10596883.html