DNA序列相似性比对 - C++代码实现
#include <iostream>
#include <string>
using namespace std;
int main() {
double threshold;
string dna1, dna2;
cin >> threshold;
cin >> dna1 >> dna2;
int count = 0;
int total = dna1.length();
for (int i = 0; i < total; i++) {
if (dna1[i] == dna2[i]) {
count++;
}
}
double similarity = (double)count / total;
if (similarity >= threshold) {
cout << "yes" << endl;
} else {
cout << "no" << endl;
}
return 0;
}
原文地址: https://www.cveoy.top/t/topic/cERs 著作权归作者所有。请勿转载和采集!