码迷,mamicode.com
首页 > 其他好文 > 详细

HR_Hash Tables: Ransom Note

时间:2018-10-09 18:09:36      阅读:140      评论:0      收藏:0      [点我收藏+]

标签:case   let   __name__   sorted   note   dex   ted   bsp   split()   

1 题目重点:whole words | case-sensitive

#!/bin/python3

import math
import os
import random
import re
import sys

# Complete the checkMagazine function below.
def checkMagazine(magazine, note):
    # m_len magazine  n_len note
    m_len = len(magazine)
    n_len = len(note)
    # magazine = sorted(magazine)
    # note = sorted(note)
    for i in range(n):
        try:
            temp = magazine.index(note[i])
            magazine[temp] = 0
        except ValueError:
            return No
    return Yes

if __name__ == __main__:
    mn = input().split()

    m = int(mn[0])

    n = int(mn[1])

    magazine = input().rstrip().split()

    note = input().rstrip().split()

    print(checkMagazine(magazine, note)) 
     

 

HR_Hash Tables: Ransom Note

标签:case   let   __name__   sorted   note   dex   ted   bsp   split()   

原文地址:https://www.cnblogs.com/alfredsun/p/9761565.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!