您的位置:首页 > 其它

繁华模拟赛 vicent的字符串

2016-09-24 23:10 211 查看




#include<iostream>
#include<cstdio>
#include<string>
#include<cstring>
#include<algorithm>
using namespace std;
const int maxn = 200005;
int n,k,a[maxn];
char cmd;
int main(){
freopen("str.in","r",stdin);
freopen("str.out","w",stdout);
ios::sync_with_stdio(false);
cin>>n>>k;
if(k == 1 && n == 1){
cout<<"a";
return 0;
}
if(k == 1 || k > n){
cout<<-1;
return 0;
}
int cnt = n;
for(int i = k;i >= 3;i--){
a[cnt] = i;
cnt--;
}
for(int i = 1;i <= cnt;i++){
if(i&1) a[i] = 1;
else a[i] = 2;
}
for(int i = 1;i <= n;i++){
cmd = 'a' - 1 + a[i];
cout<<cmd;
}
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: