zoukankan      html  css  js  c++  java
  • 【PAT】B1043 输出PATest(20 分)

    /*
        
    */
    #include<stdio.h>
    #include<algorithm>
    #include<string.h>
    #include<ctype.h>
    using namespace std;
    int main(){
        char temp;
        int P,A,T,e,s,t;
        P=A=T=e=s=t=0;
        while(scanf("%c",&temp)!=EOF){
            switch(temp){
            case 'P': P++;
                break;
            case 'A': A++;
                break;
            case 'T': T++;
                break;
            case 'e': e++;
                break;
            case 's': s++;
                break;
            case 't': t++;
                break;
            }
        }
        while(P!=0||A!=0||T!=0||e!=0||s!=0||t!=0){
            if(P!=0){
                printf("P");
                P--;
            }
            if(A!=0){
                printf("A");
                A--;
            }
            if(T!=0){
                printf("T");
                T--;
            }
            if(e!=0){
                printf("e");
                e--;
            }
            if(s!=0){
                printf("s");
                s--;
            }
            if(t!=0){
                printf("t");
                t--;
            }
        }
        return  0;
    }
    
  • 相关阅读:
    HDU 1423
    POJ 3264
    POJ 3177
    CodeForces 81A
    SPOJ RATING
    ZOJ 2588
    POJ 1523
    POJ 3667
    递归
    数据结构
  • 原文地址:https://www.cnblogs.com/hebust/p/9498020.html
Copyright © 2011-2022 走看看