[codes=c]void xapxep (int a[], int n)
{
for (int i=0, j<n-1; i<j;)
if (a[i]%2==0) j++;
else if (a[i]%2!=0) j–;
else
{
hoanvi(a[i], a[j]);
i++;
j–;
}
}[/codes]
p/s:
[codes=c]for (int i=0, j<n-1; i<j;) [/codes]
là thay thế của
[codes=c]
for (int i=0; i<n-1; i++)
for (int j=i+1; j<n; j++)
[/codes]
Last modified on March 31st, 2021 at 1:17 am
Nam Le
lequocnam
0 responds