当前位置:   article > 正文

Codeforces Global Round 12_antontrygub

antontrygub

Codeforces Global Round 12

A.Avoid Trygub

题意:

题解: sort一发就完事了

代码:

/*
3
11
antontrygub
15
bestcoordinator
19
trywatchinggurabruh
*/
#include <bits/stdc++.h>

using namespace std;

typedef long long LL;
typedef pair<int, int> PII;
int const N = 2e5 + 10;
int n, m, T;

// trygub
// int check(string s) {
   
//     if (s.find('t') && s.find('r') && s.find('y') && s.find('g') && s.find('u') && s.find('b')) return true;
//     return false;
// } 


int main() {
   
    cin >> T;
    while(T--) {
   
        cin >> n;
        string s;
        cin >> s;
        sort(s.begin(), s.end());
        cout << s << endl;
    }   
    return 0;
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39

B.Balls of Steel

题意:

题解: 暴力一发就完事了,不是0就是1

代码:

/*A
#include <iostream>
#include<algorithm>
using namespace std;

int main() {
    int t;
    cin >> t;
    while (t--) {
        int n;
        cin >> n;
        string s;
        cin >> s;
        sort(s.begin(),s.end());
        cout<<s<<endl;
    }
    return 0;
}*/
#include <iostream>
#include<algorithm>
using namespace std;
int x[105],y[105];
int prime[1000], cnt;
int st[1000];

// 筛素数
void init(int n) {
   
    for (int i = 2; i <= n; ++i) {
   
        if (!st[i]) prime[cnt++] = i;
        for (int j = 0; prime[j] <= n / i; ++j) {
   
            st[prime[j] * i] = 1;
            if (i % prime[j]
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/酷酷是懒虫/article/detail/1004017
推荐阅读
相关标签
  

闽ICP备14008679号