3411. 灰度直方图

Powered by:NEFU AB-IN

Link

文章目录

  • 3411. 灰度直方图
    • 题意
    • 思路
    • 代码

3411. 灰度直方图

  • 题意

    见原题

  • 思路

    模拟即可,调用Counter方法中的update,能快速处理某个对象,使其中的每个元素都加1

  • 代码

    '''
    Author: NEFU AB-IN
    Date: 2022-03-17 16:08:06
    FilePath: \ACM\Acwing\3411.py
    LastEditTime: 2022-03-17 16:09:40
    '''
    from collections import Counter
    
    n, m, l = map(int, input().split())
    
    d = Counter()
    
    for i in range(n):
        nums = map(int, input().split())
        d.update(nums)
    
    for i in range(l):
        print(d[i], end=" ")
    

你可能感兴趣的:(Acwing,ACM,CCF,python,动态规划,开发语言)