在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
思路: 构造。 实现: 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 } |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论