5 条题解

  • 1
    @ 2024-2-2 10:25:57

    这一道题非常简单,在这里为大家提供三种方法,至于选哪种,你自己选择O(∩_∩)O~

    已AC,请放心食用

    方法1:普通法

    #include <bits/stdc++.h>
    using namespace std;
    int main()
    {
        char a;
        cin >> a;
        cout << a << a << a << a << endl;
        cout << a << "  " << a << endl;
        cout << a << "  " << a << endl;
        cout << a << a << a << a;
        return 0;
    }
    

    方法2:合并法

    #include <iostream>
    using namespace std;
    int main()
    {
        char a;
        cin >> a;
        cout << a << a << a << a << endl << a << " " << " " << a << endl;
        cout << a << " " << " " << a << endl << a << a << a << a;
        return 0;
    }
    

    方法3:函数法

    #include <iostream>
    using namespace std;
    void line(char n)
    {
        for (int i = 1; i <= 4; i++)
        {
            cout << n;
        }
        cout << endl;
    }
    void mid(char n)
    {
        cout << n << "  " << n << endl;
    }
    int main()
    {
        char n;
        cin >> n;
        line(n);
        mid(n);
        mid(n);
        line(n);
        return 0;
    }
    

    养成好习惯,看后点个赞😎!

    Accepted 0.547999ms 6984KiB
    
    • 1
      @ 2023-5-23 18:53:40
      #include <bits/stdc++.h>
      using namespace std;
      char a;
      int main()
      {
          cin >> a;
          cout << a << a << a << a << endl;
          cout << a << "  " << a << endl;
          cout << a << "  " << a << endl;
          cout << a << a << a << a;
          return 0;
      }
      

      代码已AC,请放行食用

      • 1
        @ 2022-12-13 12:55:16
        #include <iostream>
        using namespace std;
        int main()
        {
            char a;
            cin >> a;
            cout << a << a << a << a << endl << a << " " << " " << a << endl;
            cout << a << " " << " " << a << endl << a << a << a << a;
            return 0;
        }
        
        • 0
          @ 2022-12-16 20:37:42
          #include <iostream>//hetao3097453
          using namespace std;
          int main()
          {
              char a;
              cin >> a;
              cout << a << a << a << a << endl;
              cout << a << "  " << a << endl;
              cout << a << "  " << a << endl;
              cout << a << a << a << a << endl;
              return 0;
          }
          
          
          • -1
            @ 2022-3-6 16:56:49

            #include<bits/stdc++.h> using namespace std; int main() { char x; cin>>x; for (int i=1;i<=4;i++) { for (int j=1;j<=4;j++) { if (((i3)||(i2))&&((j3)||(j2))) { cout<<" "; } else { cout<<x; } } cout<<endl; } return 0; }

            • 1

            信息

            ID
            1232
            时间
            1000ms
            内存
            256MiB
            难度
            5
            标签
            递交数
            413
            已通过
            145
            上传者