2 solutions

  • 1
    @ 2026-1-25 20:55:10
    #include<bits/stdc++.h>
    using namespace std;
    int main()
    {
        string a="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
        int i=0;
        int n;
        cin>>n;
        for(int j=0;j<n;j++)
        {
            for(int z=0;z<j+1;z++)
            {
                cout<<a[i%26];
                i++;
            }
            cout<<endl;
        }
    }
    
    • -1
      @ 2025-11-27 11:55:05

      C++ :

      #include <iostream>
      using namespace std;
      int main() {
       int n;
       cin >> n;
       int ch = 0;
       for (int i = 1; i <= n; i++) {
       for (int j = 1; j <= i; j++)
       cout << (char)('A' + (ch++) % 26);
       cout << endl;
       }
       return 0;
      }
      
      • 1

      Information

      ID
      44
      Time
      1000ms
      Memory
      128MiB
      Difficulty
      6
      Tags
      # Submissions
      23
      Accepted
      11
      Uploaded By