文章

2

粉丝

0

获赞

7

访问

229

头像
字符移动 题解:采用sort思路
P1012 贵州大学机试题
发布于2026年3月7日 11:36
阅读数 167

#include <iostream>

#include <cctype>

#include <algorithm>

 

using namespace std;


 

bool CompareMy(char a, char b){

if(!isdigit(a)&&isdigit(b)){

return true;

}

return false;

};

 

int main() {

string str;

getline(cin, str);

 

stable_sort(str.begin(),str.end(), CompareMy);

cout<<str<<endl;

return 0;

}

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发