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; }
浙公网安备 33010602011771号