CodeForces 709C Letters Cyclic Shift

贪心。

肯定是两个$a$之间的那些字符都$-1$,没有$a$就全部$-1$。如果输入的串全是$a$,那么把最后一个$a$改成$z$。

#pragma comment(linker, "/STACK:1024000000,1024000000")
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<iostream>
using namespace std;
typedef long long LL;
const double pi=acos(-1.0),eps=1e-;
void File()
{
freopen("D:\\in.txt","r",stdin);
freopen("D:\\out.txt","w",stdout);
}
template <class T>
inline void read(T &x)
{
char c = getchar(); x = ;while(!isdigit(c)) c = getchar();
while(isdigit(c)) { x = x * + c - ''; c = getchar(); }
} const int maxn=;
char s[maxn]; bool flag; int main()
{
scanf("%s",s);
for(int i=;s[i];i++)
{
if(s[i]=='a')
{
if(flag==) continue;
else break;
}
s[i]--; flag=;
} if(flag==)
{
int len=strlen(s);
s[len-]='z';
}
printf("%s\n",s); return ;
}
上一篇:Egret之JSZip基础


下一篇:使用glide进行包管理