字符串进位。。
#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("! ") #define INF 10000 #define MAXN 5010 #define MAX(a,b) a>b?a:b #define blank pf(" ") #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 "); else pf("%s ",s); } }