NOI 1.7 03:基因相关性

http://noi.openjudge.cn/ch0107/03/

思路:水题,将阈值数据和两行字符串读入,逐个比较即可

#include <iostream>
#include <iomanip>
#include <iostream>
#include <cmath>
#include <string.h>
#include <stdio.h>
using namespace std;
int main()
{
    char str1[1000];
    char str2[1000];
    float flag;
    cin>>flag;
    cin>>str1;
    cin>>str2;
    int maxlen = strlen(str1);
    float s = 0;//相同的数量
    for(int i=0;i<maxlen;i++)
    {
        if(str2[i]==str1[i])
            s++;
        
    }
    // cout<<s/maxlen;
    if((s/maxlen)>flag)
        cout<<"yes"<<endl;
    else
        cout<<"no"<<endl;
}

 

posted @ 2020-07-28 10:27  MEYE66  阅读(589)  评论(0)    收藏  举报