Answers for "sinh hoan vi c++"

C++
0

sinh hoan vi c++

OK = false ;
while(!OK) {
	in();
	int t = n-1;
	while(a[t] > a[t+1]) t--;
	if(t) {
		int i = n;
		while(a[i] < a[t]) i--;
		swap(a[i],a[t]);
		int l = t+1, r= n;
		while(l<r) {
			swap(a[l],a[r]);
			l++; r--;
		}
	} else OK = true;
}
Posted by: Guest on July-20-2021

Browse Popular Code Answers by Language