您的位置:首页 > 其它

SZU1

2016-03-13 11:11 211 查看
CodeForces 518A

字符串进位。。

#include <iostream>
#include <string>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <cctype>
#include <vector>
#include <iterator>
#include <set>
#include <map>
#include <sstream>
using namespace std;

#define mem(a,b) memset(a,b,sizeof(a))
#define pf printf
#define sf scanf
#define spf sprintf
#define pb push_back
#define debug printf("!\n")
#define INF 10000
#define MAXN 5010
#define MAX(a,b) a>b?a:b
#define blank pf("\n")
#define LL long long
#define ALL(x) x.begin(),x.end()
#define INS(x) inserter(x,x.begin())
#define pqueue priority_queue

char s[105],t[105];

int main()
{
int i,j;
while(sf("%s%s",s,t)==2)
{
int len = strlen(s);
int x = len-1;
for(i=0;i<len;i++)
{
if(s[x]=='z')
{
s[x]='a';
x--;
}
else
{
s[x]++;
break;
}
}
if(!strcmp(s,t)) pf("No such string\n");
else pf("%s\n",s);
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: