-
L - Por Costel and the Semipalindromes
- Gym - 100923L
- 注意还得是符合要求的字典序即收尾相同
-
#include<bits/stdc++.h> using namespace std; #define ll long long #define maxn 111 ll t,n,k,sum; char str[maxn]; int main() { scanf("%lld",&t); while(t--) { scanf("%lld%lld",&n,&k); k--; for(int i=n-1; i>0; i--) { if(k%2) str[i]='b'; else str[i]='a'; k/=2; } str[n]=str[1]; for(int i=1; i<=n; i++) printf("%c",str[i]); printf("\n"); } return 0; }
L - Por Costel and the Semipalindromes -二进制枚举字典序
最新推荐文章于 2020-10-23 08:38:45 发布