数组元素循环右移及静态链表

1. 静态链表

https://github.com/BodhiXing/Data_Structure

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 }
原文地址:https://www.cnblogs.com/boyiliushui/p/6119699.html