当前位置:网站首页>aaaaaaaaaaA heH heH nuN
aaaaaaaaaaA heH heH nuN
2022-07-25 11:14:00 【梦中醉卧惊起】
aaaaaaaaaaA heH heH nuN
题意:
规定一个字符串芳香的前缀是nunhehheh,后缀是数量个的a;给定一个n ,找出有n个芳香子序列的字符串。
思路:
nunhehheh + a * x,有2^x - 1个有效子序列
nunhehhe hhhha ,有p个h,则有p个有效子序列
那么在最后一个a前面加一个h就可以构成2 ^ x个有效子串
例如 haha == 4 haaha == 8
直接对应到2进制,所以我们直接枚举有多少个二进制位有1,然后在最前面那个a后面加h和对应二进制位上加h(即a与a之间的空位)即可构造
AC代码:
#include <iostream>
#include <algorithm>
#include <bitset>
#include <string.h>
using namespace std;
int s[50];
void solve(){
int n;cin >> n;
bitset<33>q(n);
memset(s,0,sizeof s);
if(q.test(0)) s[1] ++;
for(int i = 1;i <= 31;i ++)
if(q.test(i)) s[i]++,s[1]++;
cout << "nunhehhe";
for(int i = 31;i > 0;i --){
for(int j = 0;j < s[i];j ++)
cout << "h";
cout << "a";
}
cout << endl;
return;
}
int main(){
int t;cin >> t;
while(t --){
solve();
}
return 0;
}
边栏推荐
- Hardware connection server TCP communication protocol gateway
- LeetCode 50. Pow(x,n)
- Experimental reproduction of image classification (reasoning only) based on caffe resnet-50 network
- PHP one server sends pictures to another. Curl post file_ get_ Contents save pictures
- 【多模态】《HiT: Hierarchical Transformer with Momentum Contrast for Video-Text Retrieval》ICCV 2021
- [high concurrency] Why is the simpledateformat class thread safe? (six solutions are attached, which are recommended for collection)
- Transformer variants (spark transformer, longformer, switch transformer)
- Power BI----这几个技能让报表更具“逼格“
- MySQL historical data supplement new data
- GPT plus money (OpenAI CLIP,DALL-E)
猜你喜欢

'C:\xampp\php\ext\php_zip.dll' - %1 不是有效的 Win32 应用程序 解决
![[multimodal] transferrec: learning transferable recommendation from texture of modality feedback arXiv '22](/img/02/5f24b4af44f2f9933ce0f031d69a19.png)
[multimodal] transferrec: learning transferable recommendation from texture of modality feedback arXiv '22

LeetCode 50. Pow(x,n)

Transformer变体(Routing Transformer,Linformer,Big Bird)

Power Bi -- these skills make the report more "compelling"“

【RS采样】A Gain-Tuning Dynamic Negative Sampler for Recommendation (WWW 2022)
![[imx6ull notes] - a preliminary exploration of the underlying driver of the kernel](/img/0f/a0139be99c61fde08e73a5be6d6b4c.png)
[imx6ull notes] - a preliminary exploration of the underlying driver of the kernel

Meta-learning(元学习与少样本学习)

对比学习的应用(LCGNN,VideoMoCo,GraphCL,XMC-GAN)

php curl post Length Required 错误设置header头
随机推荐
程序员送给女孩子的精美礼物,H5立方体,唯美,精致,高清
Innovation and breakthrough! AsiaInfo technology helped a province of China Mobile complete the independent and controllable transformation of its core accounting database
【Debias】Model-Agnostic Counterfactual Reasoning for Eliminating Popularity Bias in RS(KDD‘21)
剑指 Offer 22. 链表中倒数第k个节点
Hardware connection server TCP communication protocol gateway
dirReader.readEntries 兼容性问题 。异常错误DOMException
【RS采样】A Gain-Tuning Dynamic Negative Sampler for Recommendation (WWW 2022)
Arrays in JS
dirReader. Readentries compatibility issues. Exception error domexception
Web APIs(获取元素 事件基础 操作元素)
什么是全局事件总线?
[RS sampling] a gain tuning dynamic negative sampler for recommendation (WWW 2022)
Differences in usage between tostring() and new string()
【GCN-RS】Towards Representation Alignment and Uniformity in Collaborative Filtering (KDD‘22)
Power BI----这几个技能让报表更具“逼格“
The JSP specification requires that an attribute name is preceded by whitespace
【AI4Code】《CoSQA: 20,000+ Web Queries for Code Search and Question Answering》 ACL 2021
对比学习的应用(LCGNN,VideoMoCo,GraphCL,XMC-GAN)
JS作用域以及预解析
【图攻防】《Backdoor Attacks to Graph Neural Networks 》(SACMAT‘21)