1. 静态链表
https://github.com/BodhiXing/Data_Structure/tree/master/StaticListDemo
2. 数组元素循环右移
https://pta.patest.cn/pta/test/17/exam/4/question/262
思路:不做循环,只是换方式打印输出。
1 #include <stdio.h> 2 #include <math.h> 3 4 5 int main() { 6 int n,m,i; 7 scanf("%d %d",&n,&m); 8 int a[n]; 9 for(i=0; i<n; i++) 10 scanf("%d",&a[i]); 11 //M>N 12 while(m>=n) 13 m %= n; 14 for(i=n-m; i<n; i++) 15 printf("%d ",a[i]); 16 for(i=0; i<n-m-1; i++) { 17 printf("%d ",a[i]); 18 } 19 //注意:序列结尾不能有多余空格 20 printf("%d",a[i]); 21 return 0; 22 }
时间: 2024-12-20 01:08:36