#include
#include
#include
using namespace std;
const int N = 1e6 + 5;
int n, m, K, a[N];
void solve() {
cin >> n >> m >> K;
for (int i = 0; i n; i++)
for (int j = 0; j m; j++)
cin >> a[i * m + j];
int tot = n * m;
K %= tot;
if (K) rotate(a, a + K, a + tot);
for (int i = 0; i n; i++)
for (int j = 0; j m; j++) {
cout a[i * m + j];
char c = j == m - 1 ? 'n' : ' ';
cout c;
}
}
int main() {
int T;
cin >> T;
while (T--) solve();
return 0;
}
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/4615/viewspace-2796960/ ,如需转载,请注明出处,否则将追究法律责任。