题目链接: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. windows android ndk的某些编译工具报错乱码0x5 或拒绝访问05

    在IDEA或者AndroidStudio的快捷方式上右键属性 > 兼容性 > 以管理员身份运行 解决问题.

  2. node.js爬取ajax接口数据

    爬取页面数据与爬取接口数据,我还是觉得爬取接口数据更加简单一点,主要爬取一些分页的数据. 爬取步骤: 1.明确目标接口地址,举个例子 : https://www.vcg.com/api/common/ ...

  3. 3.1.3 Spring之AOP

    三.Spring之AOP 1. 代理模式 (1) 什么是代理模式? 代理模式是面向对象编程的23种基础设计模式之一.为其他对象(代理对象)提供一种代理以控制对这个对象(源对象)的访问. 就是说,声明一 ...

  4. windows slaver 脚本执行xcopy 报错无效驱动器规格

    jenkins上配置的windows slaver机器如下: 我用这台windows 机器作为slaver机器来编译pc的exe包,但是在最后归档包倒ftp上时报错,如下: 但是我直接在windows ...

  5. FB面经 Prepare: K closest point to the origin

    Give n points on 2-D plane, find the K closest points to origin Based on bucket sort: package fbPrac ...

  6. #WEB安全基础 : HTTP协议 | 文章索引

    本系列讲解WEB安全所需要的HTTP协议 #WEB安全基础 : HTTP协议 | 0x0 TCP/IP四层结构 #WEB安全基础 : HTTP协议 | 0x1 TCP/IP通信 #WEB安全基础 : ...

  7. sql中批量插入begin的使用

    private static String ADD_ATTR_EXT_ITEM="insert into attr_ext_item(attr_ext_main_key,attr_name_ ...

  8. How to emulate a Raspberry Pi on your PC

    How to emulate a Raspberry Pi on your PC I am very interested in trying simulators and emulators for ...

  9. django 后端反向生成url

    导入模块 from django.core.urlresolvers import reverse reverse() reverse(viewname, urlconf=None, args=Non ...

  10. Machine Learning 第一二周

    # ML week 1 2 一.关于machine learning的名词 学习 从无数数据提供的E:experience中找到一个函数使得得到T:task后能够得到P:prediction 监督学习 ...