字符串存大数

参考博客

#include<bits/stdc++.h>
using namespace std;
int k,len;
string str;
int main(){
    cin >> str;
    cin >> k;
    len=str.size();
  while(k){
    for(int i=0;i<len&&k;++i){
        if(str[i]>str[i+1]){
            for(int j=i;j<len;++j){
                str[j]=str[j+1];
            }
            i-=2;k--;len--;
        }
    }
  }
    int p=0;
    while(p<len&&str[p]=='0') p++;
    if(p==len) cout << 0;
    else{
        for(;p<len;p++){
            cout << str[p];
        }
    }
    return 0;
} 
全部评论

相关推荐

林后润:听说他们有kpi,要到了简历编号就不理人了
27届求职交流
点赞 评论 收藏
分享
04-03 15:12
已编辑
门头沟学院 Java
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务