文章

3

粉丝

157

获赞

2

访问

2.4k

头像
字符移动 题解:
P1012 贵州大学机试题
发布于2023年10月25日 18:32
阅读数 796

//

//  字符移动.cpp

//  Algorithm

//

//  Created by Apricity on 2023/10/25.

//

 

#include<iostream>

#include<cmath>

#include<cstring>

#include<algorithm>

#include<queue>

using namespace std;

int main(){

    

    char a[100];

    queue<int> q;

    queue<int> q2;

    gets(a);

    //cout<<strlen(a)<<'\n';

    for(int i=0;i<strlen(a);i++){   //strlen()输出元素数量,而sizeof()输出占用空间

        

        if(!isdigit(a[i])){

            q.push(a[i]);      //一个队列存放非数字

        }

        else

            q2.push(a[i]);    //一个存放数字

    }

    while (!q.empty()) {

   ...

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发