当前位置:首页 > 技术杂谈 > 正文

1043 输出PATest

2024-03-31 技术杂谈

水题。还是一道hash题。

#include<iostream>
using namespace std;
int main() {
    int map[128] = {0};
    char c;
    while (scanf("%c",&c) != EOF) map[c]  ;
    while (map[P] > 0 || map[A] > 0 || map[T] > 0 || map[e] > 0 || map[s] > 0 || map[t] > 0) {
        if (map[P]-- > 0) cout << P;
        if (map[A]-- > 0) cout << A;
        if (map[T]-- > 0) cout << T;
        if (map[e]-- > 0) cout << e;
        if (map[s]-- > 0) cout << s;
        if (map[t]-- > 0) cout << t;
    }
    return 0;
}

 

温馨提示: 本文由Jm博客推荐,转载请保留链接: https://www.jmwww.net/a/17128.html