蓝桥杯(概率题)
来源:互联网 发布:老干部网络意思 编辑:程序博客网 时间:2024/05/17 10:56
#include<iostream>
#include<set>#include<vector>
#include<string>
#include<algorithm>
using namespace std;
int cnt=0;
char a[4]={'a','b','c','d'};
bool test(string s)
{
int ans=0;
int len=s.size();
for (int i = 0; i < len; i++)
{
if(s[i]=='a')
ans++;
}
if(ans%2==0)
return true;
else
return false;
}
void dfs(int n,string s)
{
if(n==6)
{
if(test(s))
{
cout<<s<<endl;
cnt++;
}
return;
}
for (int i = 0; i < 4; i++)
{
dfs(n+1,s+a[i]);
}
return ;
}
int main()
{
string s="";
dfs(1,s);
cout<<cnt<<endl;
system("pause");
return 0;
}
- 蓝桥杯(概率题)
- 蓝桥杯(概率题)
- 蓝桥杯(比赛概率题)
- 蓝桥杯 - 概率计算 (概率DP)
- 蓝桥杯(夺冠概率)
- 概率题(1)
- 蓝桥杯 算法提高 概率计算 (概率DP)
- 蓝桥杯算法提高——概率计算(概率dp)
- 蓝桥杯 概率计算(DP)
- 一道概率题(笔试)
- 博弈概率题(1)
- 概率题(扔硬币)
- hdu5978(概率思维题)
- 概率题
- 概率题
- 概率题
- 概率题
- 概率题
- 获取货币汇率API
- rank()随机函数的使用
- 第4章 商业蜂窝通信系统的典范-GSM
- 排列组合 poj Paths on a grid
- Stardict 字典下载地址(也是一Ubuntu源)
- 蓝桥杯(概率题)
- Java的初始化顺序
- mysql-connector移植到mini2440
- Ubuntu JDK1.6 安装
- VS2010/MFC编程入门教程之目录和总结
- 归并排序
- 安卓模拟器上安装卸载apk文件教程
- Nutch抓取数据内容的详解
- 第三届蓝桥杯预选赛试题及答案