牛客网编程题 俄罗斯方块

天大地大妈咪最大 提交于 2020-01-07 23:35:24

https://www.nowcoder.com/practice/9407e24a70b04fedba4ab3bd3ae29704?tpId=98&tqId=32832&tPage=1&rp=1&ru=/ta/2019test&qru=/ta/2019test/question-ranking

代码如下:

#include<iostream>
#include<stdio.h>
#include<cmath>
#define INF 0x3f3f3f3f
using namespace std;

int n,m,a[1005]={0},res=INF;

int main(){
    scanf("%d%d",&n,&m);
    int t;
    for(int i=0;i<m;i++){
        scanf("%d",&t);
        a[t]++;
    }
    for(int i=1;i<=n;i++){
        res=min(res,a[i]);
    }
    printf("%d",res);
    return 0;
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!