1 条题解

  • 0
    @ 2025-2-14 19:38:57

    Python :

    # coding=utf-8
    def main():
        # 读取输入
        threshold = float(input())  # 阈值
        dna1 = input().strip()  # 第一条DNA序列
        dna2 = input().strip()  # 第二条DNA序列
        
        # 初始化相同碱基对的计数器
        same_count = 0
        total_count = len(dna1)  # 两条DNA序列长度相同
        
        # 遍历两条序列,比较相同位置的碱基
        for i in range(total_count):
            if dna1[i] == dna2[i]:  # 如果两个碱基相同
                same_count += 1
        
        # 计算相同碱基对的比例
        similarity = same_count / total_count
        
        # 根据比例与阈值比较,输出结果
        if similarity >= threshold:
            print("yes")
        else:
            print("no")
    
    # 调用主函数
    main()
    
    
    • 1

    信息

    ID
    132
    时间
    1000ms
    内存
    256MiB
    难度
    (无)
    标签
    递交数
    0
    已通过
    0
    上传者