40 lines
939 B
C++
40 lines
939 B
C++
#include <iostream>
|
||
|
||
using namespace std;
|
||
|
||
int main()
|
||
{
|
||
char ch[26],l,r;
|
||
int w,i,k,j;
|
||
cin>>i>>j>>w;
|
||
l=i+'a'-1; //把数字转换成字母
|
||
r=j+'a'-1;
|
||
cin>>ch;
|
||
for(i=1;i<=5;i++)
|
||
{
|
||
j=w-1; //从'个位'开始加
|
||
cout<<"从'个位'开始加 i的数值:"<<i<<endl;
|
||
//------------------------------------------------重
|
||
while(j>=0&&ch[j]==r+j+1-w)
|
||
{
|
||
printf("%c ",r+j+1-w);
|
||
cout<<ch[j]<<" "<<"ttt这个时候的j:"<<j<<" 这个时候的ch:"<<ch<<endl;
|
||
j--; //找到当前为了把数变大,所必须进的位最小在哪
|
||
}
|
||
if(j==-1)
|
||
break;
|
||
//------------------------------------------------点
|
||
cout<<"yuanlai:"<<ch[j];
|
||
ch[j]++; //进位
|
||
cout<<"升级进位变成:"<<ch[j]<<endl;
|
||
for (k=j+1;k<=w-1;k++)
|
||
ch[k]=ch[k-1]+1; //所需进位之后的所有位都需变大
|
||
cout<<ch<<endl;
|
||
}
|
||
return 0;
|
||
}
|
||
/*
|
||
备注:数字中,是1<2<3<4...
|
||
而Jam数中,则是a>b>c>d...
|
||
*/
|