首页 > 其他 > 详细

繁华模拟赛 vicent的字符串

时间:2016-09-25 00:48:12      阅读:171      评论:0      收藏:0      [点我收藏+]

技术分享

技术分享

 

#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;
}

 

繁华模拟赛 vicent的字符串

原文:http://www.cnblogs.com/hyfer/p/5904451.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!