# codeforces 390d Inna and Sweet Matrix

#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <algorithm>
using namespace std;
#define ll __int64
struct node
{
int x,y;
}a[2505];
bool cmp(node a,node b)
{
return a.x+a.y<b.x+b.y;
}
int main()
{
int n,m,k;
scanf("%d%d%d",&n,&m,&k);
int p=1;
for(int i=1;i<=n;i++)
{
for(int j=1;j<=m;j++)
{
a[p].x=i;
a[p].y=j;
p++;
}
}
sort(a+1,a+n*m+1,cmp);
//	for(int i=1;i<=n*m;i++)
//	{
//		cout<<a[i].x<<" "<<a[i].y<<endl;
//	}
int sum=0;
for(int i=1;i<=k;i++)
{
sum+=(a[i].x+a[i].y-1);
}
printf("%d\n",sum);
for(int i=k;i>=1;i--)
{
for(int j=1;j<=a[i].x;j++)
{
printf("(%d,1) ",j);
}
for(int l=2;l<=a[i].y;l++)
{
printf("(%d,%d) ",a[i].x,l);
}
cout<<endl;
}
return 0;
}

#### CF 390D：Inna and Sweet Matrix

2014-03-07 01:21:44

#### Codeforces 390D Inna and Sweet Matrix(贪心）

2014-02-13 19:07:10

#### CodeForces - 366C Dima and Salad （DP&01背包）

2016-03-29 16:49:45

#### Codeforces 390E Inna and Large Sweet Matrix(树状数组）

2014-02-13 21:06:06

#### Codeforces #229 D2D： Inna and Sweet Matrix

2014-02-13 19:20:25

#### CodeForces 390E Inna and Large Sweet Matrix

2014-02-14 16:11:36

#### Codeforces 390 E. Inna and Large Sweet Matrix

2014-02-13 13:38:58

#### codeforces 602 D. Lipshitz Sequence (单调栈)

2015-11-25 20:25:40

#### codeforces954 C. Matrix Walk【思维】

2018-03-22 16:57:40

#### Codeforces Round #495 (Div. 2) D. Sonya and Matrix[思维构造]

2018-07-07 11:33:50