#36892: c++別急著換


mu0975353917@gmail.com (Moon Chan)


#include<bits/stdc++.h>
using namespace std;
int main()
{
int R,C,N;
while(cin>>R>>C>>N)
{
int M[R][C]={0};
int w=1;
for(int i=((N-1)/2)%R;i<R;i++)
{
for(int j=(N/2)%C;j<C;j++)
{
M[i][j]=w;
w++;
}
for(int j=0;j<(N/2)%C;j++)
{
M[i][j]=w;
w++;
}
}
for(int i=0;i<((N-1)/2)%R;i++)
{
for(int j=(N/2)%C;j<C;j++)
{
M[i][j]=w;
w++;
}
for(int j=0;j<(N/2)%C;j++)
{
M[i][j]=w;
w++;
}
}
for(int i=0;i<R;i++)
{
for(int j=0;j<C;j++)
{
cout<<M[i][j]<<" ";
}
cout<<endl;
}
 
}
 }