PTA 乙级 1036 跟奥巴马一起编程 (15分) C/C++
水,补题
C++
1 #include<iostream> 2 #include<cmath> 3 using namespace std; 4 5 int main() { 6 int n = 0; 7 char s; 8 cin >> n >> s; 9 int b = round((double)n / 2); 10 for (int i = 1; i <= b; i++) { 11 for (int j = 1; j <= n; j++) { 12 if (i == 1 || i == b)cout << s; 13 else if (j == 1 || j == n)cout << s; 14 else cout << " "; 15 } 16 cout << endl; 17 } 18 return 0; 19 }
默默地一点点变强,细节决定成败