CF939B Hamster Farm

    • 142通过
    • 467提交
  • 题目来源 CodeForces 939B
  • 评测方式 RemoteJudge
  • 标签 枚举,暴力 模拟 高精
  • 难度 入门难度
  • 时空限制 2000ms / 256MB

题解

  • 提示:收藏到任务计划后,可在首页查看。
  • 最新讨论 显示

    推荐的相关题目 显示

    题意翻译

    Dima有$n$ 只仓鼠,有$k$ 种盒子,每种盒子编号为1~k,可以装$a_i$ 只仓鼠,所有盒子都要装满仓鼠,剩下的仓鼠不装,Dima想让剩下的仓鼠最少,求应选盒子和盒子总数,如果有多种情况,输出任意一种。

    输入格式:第一行为n和k,第二行为$a_1,a_2,\ldots,a_k$ 。

    输出格式:一行,两个整数,表示应选盒子种类的编号和盒子总数。

    感谢 @WDLGZH2017 提供的翻译。

    题目描述

    Dima has a hamsters farm. Soon $ N $ hamsters will grow up on it and Dima will sell them in a city nearby.

    Hamsters should be transported in boxes. If some box is not completely full, the hamsters in it are bored, that's why each box should be completely full with hamsters.

    Dima can buy boxes at a factory. The factory produces boxes of $ K $ kinds, boxes of the $ i $ -th kind can contain in themselves $ a_{i} $ hamsters. Dima can buy any amount of boxes, but he should buy boxes of only one kind to get a wholesale discount.

    Of course, Dima would buy boxes in such a way that each box can be completely filled with hamsters and transported to the city. If there is no place for some hamsters, Dima will leave them on the farm.

    Find out how many boxes and of which type should Dima buy to transport maximum number of hamsters.

    输入输出格式

    输入格式:

    The first line contains two integers $ N $ and $ K $ ( $ 0<=N<=10^{18} $ , $ 1<=K<=10^{5} $ ) — the number of hamsters that will grow up on Dima's farm and the number of types of boxes that the factory produces.

    The second line contains $ K $ integers $ a_{1} $ , $ a_{2} $ , ..., $ a_{K} $ ( $ 1<=a_{i}<=10^{18} $ for all $ i $ ) — the capacities of boxes.

    输出格式:

    Output two integers: the type of boxes that Dima should buy and the number of boxes of that type Dima should buy. Types of boxes are numbered from $ 1 $ to $ K $ in the order they are given in input.

    If there are many correct answers, output any of them.

    输入输出样例

    输入样例#1: 复制
    19 3
    5 4 10
    
    输出样例#1: 复制
    2 4
    
    输入样例#2: 复制
    28 3
    5 6 30
    
    输出样例#2: 复制
    1 5
    
    提示
    标程仅供做题后或实在无思路时参考。
    请自觉、自律地使用该功能并请对自己的学习负责。
    如果发现恶意抄袭标程,将按照I类违反进行处理。