CodeForces 288A Polo the Penguin and Strings

构造出前面都是a,b交替的字符串,最后一组在a,b之后添加c,d……这就是所求字符串。

#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#define CPY(A, B) memcpy(A, B, sizeof(A))
typedef long long LL;
typedef unsigned long long uLL;
const int MOD = 1e9 + 7;
const int INF = 0x3f3f3f3f;
const LL INFF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-9;
const double OO = 1e20;
const double PI = acos (-1.0);
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
using namespace std;
const int maxn=1e6+10;
char S[maxn];
int main() {
    int n,k; cin>>n>>k;
    if (nn-k+2; i--) {
        S[i]=k+i-n-1+'a';//the last
    }
    for (int i=1; i<=n; i++) {printf ("%c",S[i]);}
    puts ("");
    return 0;
}

你可能感兴趣的:(CodeForces,构造)