注意sum要强制类型转换double
否则答案错误
C++ 代码
#include<bits/stdc++.h>
using namespace std;
int main()
{
string a,b;
int sum=0;
double t;
cin>>t>>a>>b;
for(int i=0;i < a.size(); i++)
if(a[i] == b[i])
sum++;
double n = (double)sum / a.size();
n >= t ? cout<<"yes" : cout<<"no";
}