思路:
构造。
实现:
1 #include<bits/stdc++.h> 2 using namespace std; 3 4 int main() 5 { 6 int n; 7 while (cin >> n) 8 { 9 cout << 3 * n + 4 << endl; 10 int x = 0, y = 0; 11 cout << x + 1 << " " << y << endl; 12 cout << x << " " << y + 1 << endl; 13 cout << x + 1 << " " << y + 1 << endl; 14 for (int i = 0; i < n; i++) 15 { 16 cout << x << " " << y << endl; 17 cout << x - 1 << " " << y << endl; 18 cout << x << " " << y - 1 << endl; 19 x--; y--; 20 } 21 cout << x << " " << y << endl; 22 } 23 return 0; 24 }