1036.跟奥巴马一起编程

xiaoxiao2021-02-28  45

#include <iostream> using namespace std; int main() { int n; char a; cin >> n >> a; int m = n / 2; if(n % 2 != 0) { m++; } for(int i = 0; i < m; i++) { if(i == 0 || i == m - 1) { for(int j = 0; j < n; j++) { cout << a; } } else { for(int j = 0; j < n; j++) { if(j == 0 || j == n - 1) { cout << a; } else { cout << " "; } } } cout << endl; } return 0; }
转载请注明原文地址: https://www.6miu.com/read-2628162.html

最新回复(0)