Pagini recente » Cod sursa (job #2610927) | Cod sursa (job #2768209) | Cod sursa (job #3180601) | Cod sursa (job #2300042) | Cod sursa (job #2664665)
#include <bits/stdc++.h>
using namespace std;
ifstream f("dame.in");
ofstream g("dame.out");
bool colon[1005];
bool mat[1005][1005];
int dame;
int n;
int main()
{
f >> n;
dame = n;
int lin = 1;
int col = 2;
while (dame!=0) {
while (col <= n) {
mat[lin][col]=1;
colon[col]=1;
lin++;
col+=2;
dame--;
}
col = 1;
while (colon[col]==1) {
col++;
}
}
g << n <<'\n';
for (int i=1;i<=n;i++) {
for (int j=1;j<=n;j++) {
if (mat[i][j]==1) {
g << i << " " << j << '\n';
}
}
}
return 0;
}