题目链接:http://codeforces.com/problemset/problem/450/A

/*
* 计算一个人要是拿足够离开需要排多少次队,选排的次数多的那个人,如果两个人排的次数相同,那么要取后者;
*/ #include <cstdio> using namespace std; int main() {
int n, m;
int a, b, j, maxn;
while (scanf("%d%d", &n, &m) != EOF) {
maxn = -1;
for (int i = 1; i <= n; i++) {
scanf("%d", &a);
b = a / m;
if (a % m > 0) {
b++;
}
if (maxn <= b) {
maxn = b;
j = i;
}
}
printf("%d\n", j);
}
return 0;
}

[CodeForce 450A] Jzzhu and Children的更多相关文章

  1. 450A - Jzzhu and Children 找规律也能够模拟

    挺水的一道题.规律性非常强,在数组中找出最大的数max,用max/m计算出倍数t,然后再把数组中的书都减去t*m,之后就把数组从后遍历找出第一个大于零的即可了 #include<iostream ...

  2. Codeforces Round #257 (Div. 2) A. Jzzhu and Children(简单题)

    题目链接:http://codeforces.com/problemset/problem/450/A ------------------------------------------------ ...

  3. Codeforces Round #257 (Div. 2) A. Jzzhu and Children

    A. Jzzhu and Children time limit per test 1 second memory limit per test 256 megabytes input standar ...

  4. (CF#257)A. Jzzhu and Children

    There are n children in Jzzhu's school. Jzzhu is going to give some candies to them. Let's number al ...

  5. cf #257(Div.2) A. Jzzhu and Children

    A. Jzzhu and Children time limit per test 1 second memory limit per test 256 megabytes input standar ...

  6. CF450A 【Jzzhu and Children】

    普通的模拟题这题用一个队列容器来模拟队列元素是pair类型的,first用来存每个小朋友想要的糖数,second用来存小朋友的序号,然后开始模拟,模拟出口是当队列迟到等于1时就输出当前队列里小朋友的序 ...

  7. Codeforces Round #257 (Div. 2/A)/Codeforces450A_Jzzhu and Children

    解题报告 没什么好说的,大于m的往后面放,,,re了一次,,, #include <iostream> #include <cstdio> #include <cstri ...

  8. CodeForces 450A 队列

    Description There are n children in Jzzhu's school. Jzzhu is going to give some candies to them. Let ...

  9. Codeforces Round #257 (Div. 2)

    A - Jzzhu and Children 找到最大的ceil(ai/m)即可 #include <iostream> #include <cmath> using name ...

随机推荐

  1. 关于VMware(虚拟机) 出现错误时处理办法

    我们在开发中难免会用到虚拟机.前段时间老有同学问我虚拟机报错解决办法,趁今天有空特随笔. 错误如下图 首先科普下VT是个啥? Intel VirtualTechnology(VT)既“虚拟化技术” V ...

  2. php协议流

    文件包含漏洞结合php协议流的特性,使得漏洞利用效率更高,下面的内容主要讲解协议流的使用. 0x00 测试环境: php版本: 5.2,5.3,5.5,7.0等web服务: apache2OS系统: ...

  3. linux 逆向映射

    逆向映射用于建立物理内存页和使用该页的进程的对应页表项之间的联系,在换出页时以便更新所有涉及的进程.得到物理页基址后,根据pfn_to_page可以将页框转换为page实例,page实例中的mappi ...

  4. ES6 Symbol数据类型和set-map 数据结构

    Symbol数据类型 ES6新加的数据类型,提供一个独一无二的值 { let a1 = Symbol() ;let a2 = Symbol() } //声明 { let a3 = Symbol.for ...

  5. 使用@Autowired时,取值为null

    如果取不到,可以考虑其他方式 场景: @Autowired private StringRedisTemplate redisTemplate; 想使用redisTemplate,但是使用时为null ...

  6. [LeetCode] 55. Jump Game_ Medium tag: Dynamic Programming

    Given an array of non-negative integers, you are initially positioned at the first index of the arra ...

  7. jq点击事件不生效,效果只闪现一次又立马消失的原因?

    出现的问题:jq点击事件不生效,点击的时候效果实现但又立马消失,页面重新刷新了一次 可能出现的原因: a标签href属性的原因,虽然点击事件生效,但页面又刷新了一次,所以没有效果,只闪了一次 解决方案 ...

  8. FB面经 Prepare: Count Unique Island

    数unique island, 比如 110000 110001 001101 101100 100000 总共两个unique岛,不是四个 方法可以是记录每次新的岛屿搜索的路径,left,right ...

  9. MongoDB在Windows系统下的安装和启动

    版本选择MongoDB的版本命名规范如:x.y.z: y为奇数时表示当前版本为开发版,如:2.3.0.2.1.1: y为偶数时表示当前版本为稳定版,如:2.0.1.2.2.0: 目前官网上最新的版本为 ...

  10. ORACLE中 大量数据插入表 SQL

    declare g_commit_count number; cursor cu1 is select gl_flexfields_pkg.get_description_sql(gcc.chart_ ...