川大2019 Problem A 题解:C
#include <stdio.h>
int main()
{
int a[101],n,i,t;
scanf("%d",&n);
for(i = 1; i <= n; i++)
scanf("%d",&a[i]);
for(i = 1; i <= n; i++)
if(i%2 == 0)
{
t = a[i];
a[i] = a[i-1];
a[i-1] = t;
}
for(i = 1; i <= n; i++)
printf("%d ",a[i]);
return 0;
}
登录后发布评论
暂无评论,来抢沙发