BJFU 1551 ——delightful world——————【暴搜】

delightful world

时间限制(C/C++):20000MS/30000MS          运行内存限制:65536KByte
总提交:33            测试通过:10

描述

 

Siny was once a very happy boy. But one day, something awful happened. He felt so sorrowful and he decided to leave the place where he resided at now. So he packs up his clothes and takes a plane to a completely new world called "CareFree world", people there has no worried at all and live in a delightful life. But when he arrives there, he found he has to do something challengeable so that he can be allowed to enter the delightful world.

 

His task is to guess the code. A code cosists of n numbers, and every number is a 0 or 1, he has made m attempts to guess the code. After each guess, a system will tell him how many position stand the right numebers. But he is unlucky that he never guesses more than 5 correct numbers. So he doubts the system for having mistakes in telling him the right numbers in right position. 

 

Can you tell him how many possible combinations of code exist that proves the system is working with no problems?

 

 

输入

 

There are multiple cases.

 

For each case, the first input line contains two integers n and m, which represent the number of numbers in the code and the number of attempts made by Siny.

 

Then follow m lines, each containing space-separated si and ci which correspondingly indicate Siny's attempt (a line containing n numbers which are 0 or 1) and the system's response (an integer from 0 to 5 inclusively), 6 <= n <= 35, 1 <= m <= 10.

 

 

输出

 

Print the single number which indicates how many possible combinations of code exist that proves the system is working with no problems.

 

样例输入

6 3
000000 2
010100 4
111100 2
6 3
000000 2
010100 4
111100 0

样例输出

1
0

提示

 

In the first example, there exists one possible combination that is 010111, which satisfies all the 3 results the system tells Siny, and it proves that the system is working fine without any problems.

 

 

题目来源

BJFUACM

 

 

题目大意:给你n,m表示下面的矩阵是m*n的,用0、1的行去跟矩阵的每行对比,看对应位置相同的是否为每行后面的数字,如果所有的行都能满足,那么就是一种方案,问你总的方案数。

解题思路:枚举第一行正确的位置,然后跟下面的行去比较。

 

#include<stdio.h>
#include<algorithm>
#include<string.h>
#include<math.h>
#include<string>
#include<iostream>
#include<queue>
#include<vector>
#include<set>
using namespace std;
typedef long long LL;
#define mid (L+R)/2
#define lson rt*2,L,mid
#define rson rt*2+1,mid+1,R
const int INF = 0x3f3f3f3f;
const int maxn = 1e2 + 300;
int a[maxn], v[maxn], Map[maxn][maxn];
int n, m;
int dfs(int cur,int dep){
    if(dep > a[1]){
        for(int i = 2; i <= m; i++){
            int tmp = 0;
            for(int j = 1; j <= n; j++){
                if(v[j]){
                    if(Map[i][j] == Map[1][j]){
                        tmp++;
                    }
                }else{
                    if(Map[i][j] != Map[1][j]){
                        tmp++;
                    }
                }
            }
            if(tmp != a[i]){
                return 0;
            }
        }
        return 1;
    }
    int ret = 0;
    for(int i = cur; i <= n; i++){
        v[i] = 1;
        ret += dfs(i+1,dep+1);
        v[i] = 0;
    }
    return ret;
}
int main(){
    char s[333];
    while(scanf("%d%d",&n,&m)!=EOF){
        for(int i = 1; i <= m; i++){
            scanf("%s",s);
            for(int j = 1; j <= n; j++){
                Map[i][j] = s[j-1] - '0';
            }
            scanf("%d",&a[i]);
        }
        int res = dfs(1,1);
        printf("%d\n",res);
    }
    return 0;
}

  

转载于:https://www.cnblogs.com/chengsheng/p/5435625.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
图像识别技术在病虫害检测中的应用是一个快速发展的领域,它结合了计算机视觉和机器学习算法来自动识别和分类植物上的病虫害。以下是这一技术的一些关键步骤和组成部分: 1. **数据收集**:首先需要收集大量的植物图像数据,这些数据包括健康植物的图像以及受不同病虫害影响的植物图像。 2. **图像预处理**:对收集到的图像进行处理,以提高后续分析的准确性。这可能包括调整亮度、对比度、去噪、裁剪、缩放等。 3. **特征提取**:从图像中提取有助于识别病虫害的特征。这些特征可能包括颜色、纹理、形状、边缘等。 4. **模型训练**:使用机器学习算法(如支持向量机、随机森林、卷积神经网络等)来训练模型。训练过程中,算法会学习如何根据提取的特征来识别不同的病虫害。 5. **模型验证和测试**:在独立的测试集上验证模型的性能,以确保其准确性和泛化能力。 6. **部署和应用**:将训练好的模型部署到实际的病虫害检测系统中,可以是移动应用、网页服务或集成到智能农业设备中。 7. **实时监测**:在实际应用中,系统可以实时接收植物图像,并快速给出病虫害的检测结果。 8. **持续学习**:随着时间的推移,系统可以不断学习新的病虫害样本,以提高其识别能力。 9. **用户界面**:为了方便用户使用,通常会有一个用户友好的界面,显示检测结果,并提供进一步的指导或建议。 这项技术的优势在于它可以快速、准确地识别出病虫害,甚至在早期阶段就能发现问题,从而及时采取措施。此外,它还可以减少对化学农药的依赖,支持可持续农业发展。随着技术的不断进步,图像识别在病虫害检测中的应用将越来越广泛。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值