1 条题解

  • 0
    @ 2024-2-2 12:53:09

    本题难度不大(可我还是调了7次才过) 首先明确思路,只需要按题面意思模拟即可。 AC Code

    #include <bits/stdc++.h>
    using namespace std;
    
    int n;
    int main() {
         cin >> n;
         for (int i = 1; i <= n; i++) {
         cout << "|";
         if(i == (n + 1) / 2) {
              for(int x = 1; x <= n - 2; x++) cout << '-';
         }
         else {
              for(int y = 1; y <= n - 2; y++) cout << 'a';
         }
         cout << "|";
         cout << endl;
         }
         return 0;
    }
    

    AC Record image

    • 1

    信息

    ID
    9485
    时间
    1000ms
    内存
    512MiB
    难度
    1
    标签
    递交数
    2
    已通过
    1
    上传者