B题  数据不大   暴力枚举答案即可

Natasha is planning an expedition to Mars for n

people. One of the important tasks is to provide food for each participant.

The warehouse has m

daily food packages. Each package has some food type ai

.

Each participant must eat exactly one food package each day. Due to extreme loads, each participant must eat the same food type throughout the expedition. Different participants may eat different (or the same) types of food.

Formally, for each participant j

Natasha should select his food type bj and each day j-th participant will eat one food package of type bj. The values bj

for different participants may be different.

What is the maximum possible number of days the expedition can last, following the requirements above?

Input

The first line contains two integers n

and m (1≤n≤100, 1≤m≤100

) — the number of the expedition participants and the number of the daily food packages available.

The second line contains sequence of integers a1,a2,…,am

(1≤ai≤100), where ai is the type of i

-th food package.

Output

Print the single integer — the number of days the expedition can last. If it is not possible to plan the expedition for even one day, print 0.

Examples

Input

Copy

4 10
1 5 2 1 1 1 2 5 7 2

Output

Copy

2

Input

Copy

100 1
1

Output

Copy

0

Input

Copy

2 5
5 4 3 2 1

Output

Copy

1

Input

Copy

3 9
42 42 42 42 42 42 42 42 42

Output

Copy

3

Note

In the first example, Natasha can assign type 1

food to the first participant, the same type 1 to the second, type 5 to the third and type 2 to the fourth. In this case, the expedition can last for 2 days, since each participant can get two food packages of his food type (there will be used 4 packages of type 1, two packages of type 2 and two packages of type 5

).

In the second example, there are 100

participants and only 1 food package. In this case, the expedition can't last even 1 day.

#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<string.h>
using namespace std;
int n,m,x;
int a[107];
int main(){scanf("%d %d",&n,&m);for(int i=0;i<m;i++){scanf("%d",&x);a[x]++;}for(int i=1;i<=107;i++){int t=0;for(int j=1;j<=100;j++)t+=a[j]/i;if(t<n){printf("%d",i-1);return 0;}}return 0;
}

C题

要求最少携带多少燃料,那就让携带的燃料刚好够用,刚好够用就行。也就是最后降落地球的时候,燃料刚好用完了,飞船重量是初始中重量。由这个来倒着递推回去,即可知道刚开始的重量。

每次降落前或者起飞前的重量为x   x-(x/系数)=落地后或者起飞后的重量

化简为  (落地后的重量*系数)/(系数-1)=降落前的重量。

代码

#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string.h>
using namespace std;
const int maxn=1007;
int n,a[maxn],b[maxn],flag;
double t;
int main(){scanf("%d %lf",&n,&t);for(int i=0;i<n;i++)scanf("%d",&a[i]);for(int i=0;i<n;i++)scanf("%d",&b[i]);double x=(t*b[0])/(b[0]-1);for(int i=n-1;i>=0;i--){if(a[i]-1<=0||b[i]-1<=0){flag=1;break;}x=(x*a[i])/(a[i]-1);if(i!=0)x=(x*b[i])/(b[i]-1);}if(flag)printf("-1\n");else printf("%.10lf\n",x-t);return 0;
}

codeforces Roud499Div2 B和C相关推荐

  1. CodeForces 375D Tree and Queries

    传送门:https://codeforces.com/problemset/problem/375/D 题意: 给你一颗有根树,树上每个节点都有其对应的颜色,有m次询问,每次问你以点v为父节点的子树内 ...

  2. 「日常训练」Bad Luck Island(Codeforces Round 301 Div.2 D)

    题意与分析(CodeForces 540D) 是一道概率dp题. 不过我没把它当dp做... 我就是凭着概率的直觉写的,还好这题不算难. 这题的重点在于考虑概率:他们喜相逢的概率是多少?考虑超几何分布 ...

  3. 【codeforces 812C】Sagheer and Nubian Market

    [题目链接]:http://codeforces.com/contest/812/problem/C [题意] 给你n个物品; 你可以选购k个物品;则 每个物品有一个基础价值; 然后还有一个附加价值; ...

  4. CodeForces 获得数据

    针对程序的输出可以看见 CodeForces :当输入.输出超过一定字符,会隐藏内容 所以:分若干个程序进行输入数据的获取 1. 1 for (i=1;i<=q;i++) 2 { 3 scanf ...

  5. codeforces水题100道 第二十七题 Codeforces Round #172 (Div. 2) A. Word Capitalization (strings)...

    题目链接:http://www.codeforces.com/problemset/problem/281/A 题意:将一个英文字母的首字母变成大写,然后输出. C++代码: #include < ...

  6. CodeForces 595A

    题目链接: http://codeforces.com/problemset/problem/595/A 题意: 一栋楼,有n层,每层有m户,每户有2个窗户,问这栋楼还有多少户没有睡觉(只要一个窗户灯 ...

  7. codeforces A. Jeff and Digits 解题报告

    题目链接:http://codeforces.com/problemset/problem/352/A 题目意思:给定一个只有0或5组成的序列,你要重新编排这个序列(当然你可以不取尽这些数字),使得这 ...

  8. Codeforces Round #506 (Div. 3)

    Codeforces Round #506 (Div. 3) 实习期间事不多,对div3 面向题解和数据编程了一波 A. Many Equal Substrings 题目链接 A题就是找后缀和前缀重合 ...

  9. Codeforces Round #417:E. FountainsSagheer and Apple Tree(树上博弈)

    Codeforces Round #417:E. FountainsSagheer and Apple Tree(树上博弈) 标签: codeforces 2017-06-02 11:41 29人阅读 ...

  10. [题解]RGB Substring (hard version)-前缀和(codeforces 1196D2)

    题目链接:https://codeforces.com/problemset/problem/1196/D2 题意: q 个询问,每个查询将给你一个由 n 个字符组成的字符串s,每个字符都是 &quo ...

最新文章

  1. Win 10 安装detectron2 详细手册
  2. SEO优化中影响网站关键词排名的因素有哪些?
  3. Linux 进内核,arm linux 启动流程之 进入内核
  4. 华为云mysql端口号_华为云云耀服务器远程连接mysql,报错10038端口配置问题。
  5. PHP性能调优,PHP慢日志---善用php-fpm的慢执行日志slow log,分析php性能问题
  6. 【Oracle】ORA-00054: resource busy and acquire with NOWAIT specified or timeout expired
  7. Android: app不被系统kill掉
  8. 泛微OA流程存储的数据表解析
  9. 【Arc GIS 零基础教学】环境专业专题图层水系图的绘制方法
  10. Pool:对象池源码解读
  11. Matplotlib常见图形绘制(折线图、散点图 、柱状图 、直方图 、饼图 、条形图)
  12. 信道检测手机软件 ios_【安卓+iOS】卧龙影视,老牌观影神器上架苹果TF版,支持双端,限时下载!...
  13. 简单的给数字加密解密
  14. 【Spring】Spring面试题
  15. 100m光纤测速多少正常_终于知道为什么我的百兆宽带测速只有一半了
  16. gpu z linux版本,gpu-z linux
  17. linux 文件 查找内容替换,linux递归查找文件内容并替换
  18. 即将改变世界的力量:2021年最具影响力的科技预测
  19. csrf和xss攻击
  20. Android自定义优惠券解析

热门文章

  1. 如何将PDF转换成Word
  2. python学习一:基本数据类型
  3. idea 版本控制 忽略要提交的文件
  4. SQLServer的索引和统计
  5. [Flash开发笔记] Flash 执行exe文件
  6. ubuntu samba配置
  7. systemtap打点方法
  8. 统计系统所有进程总共占用多少内存
  9. Android 学习之Fragment生命周期
  10. DPDP ACL 1 -- DPDK ACL算法介绍