You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
1.1 KiB
C++
43 lines
1.1 KiB
C++
#define _CRT_SECURE_NO_WARNINGS
|
|
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
|
|
#include <bits/stdc++.h>
|
|
using namespace std;
|
|
int main()
|
|
{
|
|
int n;
|
|
scanf("%d", &n);
|
|
printf("%d\n", n / 2 + 1);
|
|
int x = 1, y = 1;
|
|
for (int i = 1; i <= n; i++) {
|
|
printf("%d %d\n", x, y);
|
|
(y == n / 2 + 1 ? x : y)++;
|
|
}
|
|
return 0;
|
|
if (n & 1)
|
|
{
|
|
printf("%d\n", n / 2 + 1);
|
|
for (int i = 1; i <= n / 2 + 1; i++)
|
|
printf("%d %d\n", 1, i);
|
|
for (int i = n / 2 + 1 + 1; i <= n; i++)
|
|
printf("%d %d\n", i - n / 2 - 1, n / 2 + 1);
|
|
}
|
|
else
|
|
{
|
|
printf("%d\n", n / 2 + 1);
|
|
for (int i = 1; i <= n / 2 + 1; i++)
|
|
printf("%d %d\n", 1, i);
|
|
for (int i = n / 2 + 1 + 1; i <= n; i++)
|
|
printf("%d %d\n", i - n / 2 - 1, n / 2 + 1);
|
|
}
|
|
return 0;
|
|
if (n == 1)
|
|
{
|
|
puts("1\n1 1");
|
|
return 0;
|
|
}
|
|
printf("%d\n", ((n + 1) >> 1) + 1 - (n & 1));
|
|
for (int i = 1; i <= n; i++)
|
|
printf("%d %d\n", (i + 1) >> 1, ((i + 1) >> 1) + 1 - (i & 1));
|
|
return 0;
|
|
}
|