繁华模拟赛 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; }
相关文章推荐
- 繁华模拟赛 Vicent与游戏
- 繁华模拟赛 Vicent坐电梯
- 10.18 一场简单的模拟赛 递推+tarjian+字符串+贪心
- 字符串模拟赛T2
- 【2018.3.10】模拟赛之二-ssl2575 给出字符串【字符串】
- 2018.3.10 模拟赛——(2)给出字符串
- 【大二最后一题】Wannafly模拟赛 矩阵【二分+二维字符串Hash】
- noip模拟赛:电话时间[字符串]
- 常州模拟赛d4t3 字符串划分
- 2017模拟赛:字符串比较
- 2017.1.15【初中部 NOIP提高组】模拟赛B组 重复字符串(powerstr) 题解
- 繁华模拟赛 摆书
- [NOIP模拟赛]相似字符串
- 2017蓝桥杯模拟赛 Problem D: 字符串比较(9分)
- 繁华模拟赛 最优得分
- 繁华模拟赛day8 科技树
- 繁华模拟赛 过河
- 繁华模拟赛 找十字架
- 繁华模拟赛day8 字典序
- 繁华模拟赛day8 牛栏