[CodeForce 450A] Jzzhu and Children
题目链接: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的更多相关文章
- 450A - Jzzhu and Children 找规律也能够模拟
挺水的一道题.规律性非常强,在数组中找出最大的数max,用max/m计算出倍数t,然后再把数组中的书都减去t*m,之后就把数组从后遍历找出第一个大于零的即可了 #include<iostream ...
- Codeforces Round #257 (Div. 2) A. Jzzhu and Children(简单题)
题目链接:http://codeforces.com/problemset/problem/450/A ------------------------------------------------ ...
- 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 ...
- (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 ...
- 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 ...
- CF450A 【Jzzhu and Children】
普通的模拟题这题用一个队列容器来模拟队列元素是pair类型的,first用来存每个小朋友想要的糖数,second用来存小朋友的序号,然后开始模拟,模拟出口是当队列迟到等于1时就输出当前队列里小朋友的序 ...
- Codeforces Round #257 (Div. 2/A)/Codeforces450A_Jzzhu and Children
解题报告 没什么好说的,大于m的往后面放,,,re了一次,,, #include <iostream> #include <cstdio> #include <cstri ...
- CodeForces 450A 队列
Description There are n children in Jzzhu's school. Jzzhu is going to give some candies to them. Let ...
- Codeforces Round #257 (Div. 2)
A - Jzzhu and Children 找到最大的ceil(ai/m)即可 #include <iostream> #include <cmath> using name ...
随机推荐
- Nginx(三)-正向代理与反向代理
原文:正向代理与反向代理的区别 正向代理中,proxy和client同属一个LAN,对server透明: 反向代理中,proxy和server同属一个LAN,对client透明. 实际上proxy在两 ...
- oracle更具uuid排序后进行分页
oracle查询分页.一个demo,可以借用. select a.unid from ( select t.unid,rownum rowno from DEV_REG_CFG_CAMERA t wh ...
- python发送邮件心得体会
利用本地smtp server发送 windows下尝试装了两个smtp server大概配置了下,发现没法生效,也没时间仔细研究了.装上foxmail发现以前可以本地发送的选项已经无法找到. 不带附 ...
- 训练集(train set),验证集(validation set)和测试集(test set)
把数据集分为三部分,分别为:训练集(train set),验证集(validation set)和测试集(test set). 具体比例有各种说法.待补充 测试集是为了测模型泛化能力,不能在训练的时候 ...
- Visual Studio 独立 Shell 下载
https://visualstudio.microsoft.com/zh-hans/vs/older-downloads/isolated-shell/ SSMS 2017 安装问题 https:/ ...
- python导入.py文件
1.from . import D # 导入A.B.D 2.from .. import E # 导入A.E 3.from ..F import G # 导入A.F.G,.. 和 F是连着的,中间没有 ...
- windows下redis 配置文件参数说明
1.先看redis.windows.conf 文件 # Redis configuration file example # Note on units: when memory size is ne ...
- JQ得到当前登录城市和天气
$(function () { findWeather(); }); function findWeather() { var cityUrl = 'http://int.dpool.sina.com ...
- Kettle使用MySQL作为资源库报错解决方法
使用Kettle5.0.1,安装的是MySQL5.1.JDK1.6,在\data-integration\lib目录里添加mysql的JDBC包mysql-connector-java-5.0.8-b ...
- wm_concat函数的排序问题
wm_concat在行转列的时候非常有用,但在行转列的过程中的排序问题常常难以控制. 可见下面例子: 准备测试表: drop table t; create table t (n number,m n ...