#36892: c++別急著換


mu0975353917@gmail.com (Moon Chan)

學校 : 國立雲林科技大學
編號 : 188583
來源 : [36.235.71.91]
最後登入時間 :
2024-04-28 23:39:27
e974. 2. 座位安排 (Seats) -- 2019年5月TOI練習賽新手組 | From: [36.235.85.223] | 發表日期 : 2023-08-15 14:35

#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;
}
 
}
 } 
 
ZeroJudge Forum