4 条题解

  • 1
    @ 2023-10-4 9:04:12

    疯狂if语句简单了 话不多说,上代码!

    #include<iostream>
    using namespace std;
    int main()
    {
        int n;
        cin>>n;
        if(n == 1)
        {
            cout<<"A";
        }
        if(n == 2)
        {
            cout<<"A"<<endl;
            cout<<"AB"<<endl;
        }
        if(n == 3)
        {
            cout<<"A"<<endl;
            cout<<"AB"<<endl;
            cout<<"ABC"<<endl;
        }
        if(n == 4)
        {
            cout<<"A"<<endl;
            cout<<"AB"<<endl;
            cout<<"ABC"<<endl;
            cout<<"ABCD"<<endl;
        }
        if(n == 5)
        {
            cout<<"A"<<endl;
            cout<<"AB"<<endl;
            cout<<"ABC"<<endl;
            cout<<"ABCD"<<endl;
            cout<<"ABCDE"<<endl;
        }
        if(n == 6)
        {
            cout<<"A"<<endl;
            cout<<"AB"<<endl;
            cout<<"ABC"<<endl;
            cout<<"ABCD"<<endl;
            cout<<"ABCDE"<<endl;
            cout<<"ABCDEF"<<endl;
        }
        if(n == 7)
        {
            cout<<"A"<<endl;
            cout<<"AB"<<endl;
            cout<<"ABC"<<endl;
            cout<<"ABCD"<<endl;
            cout<<"ABCDE"<<endl;
            cout<<"ABCDEF"<<endl;
            cout<<"ABCDEFG"<<endl;
        }
        if(n == 8)
        {
            cout<<"A"<<endl;
            cout<<"AB"<<endl;
            cout<<"ABC"<<endl;
            cout<<"ABCD"<<endl;
            cout<<"ABCDE"<<endl;
            cout<<"ABCDEF"<<endl;
            cout<<"ABCDEFG"<<endl;
            cout<<"ABCDEFGH"<<endl;
        }
        if(n == 9)
        {
            cout<<"A"<<endl;
            cout<<"AB"<<endl;
            cout<<"ABC"<<endl;
            cout<<"ABCD"<<endl;
            cout<<"ABCDE"<<endl;
            cout<<"ABCDEF"<<endl;
            cout<<"ABCDEFG"<<endl;
            cout<<"ABCDEFGH"<<endl;
            cout<<"ABCDEFGHI"<<endl;
        }
        return 0;
    }
    
    • 0
      @ 2023-10-2 21:11:59
      #include<bits/stdc++.h>
      using namespace std;
      int main()
      {
          int n;
          cin>>n;
          for(int i=0;i<n;i++)
          {
              char x;
              for(int j=0;j<=i;j++)
              {
                  x='A'+j;
                  cout<<x;
              }
              cout<<endl;
          }
          return 0;
      }
      
      • 0
        @ 2023-7-20 19:12:10
        #include <cstdio>
        using namespace std;
        int main(){
            int n;
            scanf("%d",&n);
            for(int i=1;i<=n;i++){
                for(int j=0;j<i;j++)printf("%c",j+'A');
                printf("\n");
            }
            return 0;
        }
        

        其实就是我在【入门】字母直角2中发布的题解中第7行的i改成j

        • 0
          @ 2023-2-20 21:57:59
          #include <iostream>
          using namespace std;
          int main()
          {
          	int n;
          	cin >> n;
          	for (int i = 1; i <= n; i++)
              {
          		for (int j = 1; j <= i; j++)
                  {
          			cout << (char)(j + 64);
          		}
          		cout << endl;
          	}
              return 0;
          }
          

          Accept~~

          • 1

          信息

          ID
          973
          时间
          1000ms
          内存
          64MiB
          难度
          1
          标签
          递交数
          72
          已通过
          56
          上传者