比赛链接:https://codeforces.com/contest/1754
题解:
AB
水题
// by SkyRainWind
#include <cstdio>
#include <vector>
#include <cstring>
#include <iostream>
#include <algorithm>
#define mpr make_pair
#define debug() cerr<<"Yoshino\n"
#define rep(i,a,b) for(int (i)=(a);(i)<=(b);(i)++)
#define pii pair<int,int>
using namespace std;
typedef long long LL;
const int inf = 1e9, INF = 0x3f3f3f3f;
signed main(){
int te;scanf("%d",&te);
while(te--){
char s[1005];
int n;
scanf("%d",&n);
scanf("%s", s+ 1);
int gg = 0, st = 0;
for(int i=n;i>=1;i--)
if(s[i] == 'Q'){
if(st<=0){gg =1 ;break;}
-- st;
}else ++ st;
if(gg) puts("No");
else puts("Yes");
}
return 0;
}
// by SkyRainWind
#include <cstdio>
#include <vector>
#include <cstring>
#include <iostream>
#include <algorithm>
#define mpr make_pair
#define debug() cerr<<"Yoshino\n"
#define rep(i,a,b) for(int (i)=(a);(i)<=(b);(i)++)
#define pii pair<int,int>
using namespace std;
typedef long long LL;
const int inf = 1e9, INF = 0x3f3f3f3f;
signed main(){
int te;scanf("%d",&te);
while(te --){
int n;scanf("%d",&n);
if(n&1){
for(int i=n/2+1;i>=3;i--)printf("%d %d ",i,i+n/2);
printf("2 %d 1 ",2+n/2);
}
else{
for(int i=n/2;i>=1;i--)printf("%d %d ",i,i+n/2);
}
puts("");
}
return 0;
}
C
如果有