Accepted solution

770A - New Password

Open original problem
Source code

#include <iostream>

#include<vector>

#include<string>

#include<math.h>

#include<map>

#include<algorithm>

/***** S. M. Sabiul Hajjaj Sabit *****/

using namespace std;

template <typename T>long long int power(T a, T b)

{

    long long int pow=1;

    for(int i=0; i<b; i++)

    {

        pow *= a;

    }

    return pow;

}

///*********Write Code From Here*********///

int main()

{

    int a,b;

    int c=0;

    cin>>a>>b;

    for(int i=0; i<b; i++)

    {

        char t1 = 'a'+i;

        cout<<t1;

    }

    for(int i=0; i<a-b; i++)

    {

        if(c>=b)

        {

            c=0;

        }

        char t = 'a'+c;

        cout<<t;

        c++;

    }

    cout<<endl;

}
Join the discussion

Add your comment