码迷,mamicode.com
首页 > 编程语言 > 详细

NOIP200603 Jam的计数法(C++)

时间:2016-10-14 23:42:59      阅读:158      评论:0      收藏:0      [点我收藏+]

标签:

#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
int a,t,w,len;
char t1;
string s;
int main()
{
scanf("%d%d%d",&a,&t,&w);
t1=t+96;
cin>>s;
for(int i=1;i<=5;i++)
{
len=w-1;
for(int j=1;j!=0;j++)
{
s[len]++;
if(s[len]>t1||(len!=w-1 && s[len]>=s[len+1]))
s[len]--,len--;
else break;
if(len<=0) return 0;
}
for(int k=len+1;k<w;k++)
s[k]=s[len]+k-len;
cout<<s<<endl;
}
return 0;
}

NOIP200603 Jam的计数法(C++)

标签:

原文地址:http://www.cnblogs.com/DZRDerek/p/5962235.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!