1 条题解

  • 0
    @ 2025-7-12 10:47:42

    C++ :

    #include <bits/stdc++.h>
    using namespace std;
    
    int a[1010];
    
    int main() {
    	int n;
    	cin >>n;
    	for(int i = 0; i < n; ++i) {
    		cin >> a[i];
    	}
    	int pos = 0;
    	int t;
    	cin >>t;
    	while(t--) {
    		int x;
    		cin >> x;
    		pos -= x % n;
    		pos = (pos + n) % n;
    		for(int i = 0; i < n; ++i) {
    			cout << a[(pos + i)  % n] << " ";
    		}
    		cout <<endl;
    	}
    	return 0;
    }
    
    

    信息

    ID
    5
    时间
    1000ms
    内存
    128MiB
    难度
    (无)
    标签
    递交数
    0
    已通过
    0
    上传者