返回小组 开始 2023-08-04 15:25:00

数组+递归8.4测试

结束 2023-08-04 16:55:00
Contest is over.
当前 2024-11-22 08:41:02

sb

include <stdio.h>

int a[110]; int main() {

int n,b,s=0;
scanf("%d", &n);
for (int i = 0; i < n; i++)
{
	scanf("%d", &a[i]);
}
for (int i = 0; i < n-1; i++)
{
	for (int j = 0; j < n-1; j++)
	{
		if(a[j]>a[j+1])
		{
			int temp = a[j];
    		a[j] = a[j + 1];
    		a[j + 1] = temp;
    		
			
		}
			if (s == 1)
			{
			
  				break;	
  			}
	}	
	 
}	
for (int i = 0; i<n; i++)
{
	
	printf("%d ",a[i]);
}
return 0;

}


sioya1  •  1年前

比赛已结束。