1 条题解

  • 0
    @ 2025-7-29 20:31:38

    C++ :

    #include<bits/stdc++.h>
    #define int long long
    const int N =2e5+10;
    using namespace std;
    int n;
    string s;
    signed main(){
    	std::ios::sync_with_stdio(false);
    	std::cin.tie(nullptr);
    	cin>>s>>n;
    	while(n--){
    		int last=-1;
    		for(int i=0;i<s.size();i++){
    			if(s[i]!='z'){
    				last=i;
    				break;
    			}
    		}
    		if(last==-1) break;
    		for(int i=last;i<s.size();i++){
    			if(s[i]=='z') break;
    			s[i]++;
    		}
    	}
    	cout<<s;
    	return 0;
    }
    
    
    • 1

    信息

    ID
    4226
    时间
    1000ms
    内存
    128MiB
    难度
    3
    标签
    递交数
    0
    已通过
    0
    上传者