链接:http://codeforces.com/contest/1016/problem/A

A. Death Note

time limit per test

2 seconds

memory limit per test

256 megabytes

input

standard input

output

standard output

You received a notebook which is called Death Note. This notebook has infinite number of pages. A rule is written on the last page (huh) of this notebook. It says: "You have to write names in this notebook during nn consecutive days. During the ii-th day you have to write exactly aiai names.". You got scared (of course you got scared, who wouldn't get scared if he just receive a notebook which is named Death Note with a some strange rule written in it?).

Of course, you decided to follow this rule. When you calmed down, you came up with a strategy how you will write names in the notebook. You have calculated that each page of the notebook can contain exactly mm names. You will start writing names from the first page. You will write names on the current page as long as the limit on the number of names on this page is not exceeded. When the current page is over, you turn the page. Note that you always turn the page when it ends, it doesn't matter if it is the last day or not. If after some day the current page still can hold at least one name, during the next day you will continue writing the names from the current page.

Now you are interested in the following question: how many times will you turn the page during each day? You are interested in the number of pages you will turn each day from 11 to nn.

Input

The first line of the input contains two integers nn, mm (1≤n≤2⋅1051≤n≤2⋅105, 1≤m≤1091≤m≤109) — the number of days you will write names in the notebook and the number of names which can be written on each page of the notebook.

The second line contains nn integers a1,a2,…,ana1,a2,…,an (1≤ai≤1091≤ai≤109), where aiai means the number of names you will write in the notebook during the ii-th day.

Output

Print exactly nn integers t1,t2,…,tnt1,t2,…,tn, where titi is the number of times you will turn the page during the ii-th day.

Examples

input

Copy

3 5
3 7 9

output

Copy

0 2 1

input

Copy

4 20
10 9 19 2

output

Copy

0 0 1 1

input

Copy

1 100
99

output

Copy

0

Note

In the first example pages of the Death Note will look like this [1,1,1,2,2],[2,2,2,2,2],[3,3,3,3,3],[3,3,3,3][1,1,1,2,2],[2,2,2,2,2],[3,3,3,3,3],[3,3,3,3]. Each number of the array describes during which day name on the corresponding position will be written. It is easy to see that you should turn the first and the second page during the second day and the third page during the third day.

题目还是挺简单的,就是读题读半天。。。。

就是说有一个死亡笔记,先输入n和m,然后你可以在一页上面最多写上 m 个名字,一共写 n 天。再输入n个ai,就是你每天写上 ai 个名字,那么问你每天要翻几页。(在昨天的基础上又写了几页)注意每天的名字紧接上一天的,没写完的一页继续写

输出 i 个数字表示第 i 天又写了几页。

#include <bits/stdc++.h>
using namespace std;
int main()
{long long n,m,a,b;cin>>n>>m;a=0;for(int i=1;i<=n;i++){cin>>b;a+=b;b=a/m;cout<<b<<" ";a=a%m;}return 0;
}

A. Death Note相关推荐

  1. Activiti 工作流引擎的初步使用

    最近领导让我研究下工作流,于是查啊查就查到了Activiti,特么刚开始一直查的是Activity,查出来一堆Android的东西,我也是醉了.话不多说,下面就记录下这2天的研究成果吧. 所用环境 M ...

  2. 《死亡笔记》与绵球方块先生

    <死亡笔记>(DEATH NOTE)是最近流行日本的恐怖电影,根据漫画改编.写一个叫夜神月的男孩无意中捡到一个笔记本.他发现只要把什么人的名字写上去,谁就会在几分钟内死亡.他利用这个笔记本 ...

  3. 基础算法 —— 模拟思维

    [概述] 模拟,是根据实际问题建立模型,模拟实际按程序走一遍,最终求出答案. 思维,则是与逻辑思维有关,其需要针对题意.数据范围等抽丝剥茧抽离出有用的信息,从而得出一个结果. 对于一般的模拟,直接根据 ...

  4. 爬动漫网站数据_通过这三种动漫爱上数据科学和技术

    爬动漫网站数据 Yes, it might seem weird to mention anime, data science, and technology in the same breath. ...

  5. 【cf】Codeforces 题解等汇总

    [cf]Codeforces Round #774 (Div. 2) 前4题 [cf]Codeforces Round #774 (Div. 2) 前4题_legend_yst的博客-CSDN博客 [ ...

  6. dn什么意思_DN是什么意思中文翻译

    音标:abbr.Daily News(英.美.澳等国报纸) 网络龙之谷:通径:糖尿病肾病:公称直径 网络释义 1 . 龙之谷 KYO! 香港人气动漫电玩资讯站 ... 英雄联盟 LoL 龙之谷 DN魔 ...

  7. 用Python做词云可视化带你分析海贼王、火影和死神三大经典动漫

    对于动漫爱好者来说,海贼王.火影.死神三大动漫神作你肯定肯定不陌生了.小编身边很多的同事仍然深爱着这些经典神作,可见"中毒"至深.今天小编利用Python大法带大家分析一下这些神作 ...

  8. Python可视化,爬下豆瓣带你分析海贼王、火影和死神三大经典动漫

    对于动漫爱好者来说,海贼王.火影.死神三大动漫神作你肯定肯定不陌生了.小编身边很多的同事仍然深爱着这些经典神作,可见"中毒"至深.利用Python大法带大家分析一下这些神作,看看这 ...

  9. Python大佬用词云可视化带你分析海贼王、火影和死神三大经典动漫

    对于动漫爱好者来说,海贼王.火影.死神三大动漫神作你肯定肯定不陌生了.小编身边很多的同事仍然深爱着这些经典神作,可见"中毒"至深.利用Python大法带大家分析一下这些神作,看看这 ...

  10. 专访“三北案件”当事人,描述你我不止的背后真相

    飞段: 我,就是传说中的飞段.带有西方帅哥气质和不明邪恶能力的邪神信仰者.第一次亮相,就是我和角都在追求二尾MM的过程中,特别的造型,不一样的武器,神秘的信仰,对对手尊重的祷告,几乎使我在亮相的一瞬间 ...

最新文章

  1. INTERSECT/EXCEPT VS. IN/NOT IN
  2. CentOS上编译安装Nginx
  3. qt中label双击_qt关于QLabel控件的实现双击调用文件对话框
  4. 【BCVP升级】泛型主键的使用
  5. Vue.js视频教程
  6. java url dns_JAVA反序列化-ysoserial-URLDNS
  7. SpringCloud观后感
  8. 工具之wireshark保存rtp数据
  9. 使用代码段遍历,枚举类型Enum
  10. Linux网络嗅探器实验报告,C语言实现 Linux 网络嗅探器
  11. Unity UGUI制作HSV颜色选择器,看我表演川剧变脸
  12. 正交试验minitab
  13. redis 集群 set key报错CLUSTERDOWN Hash slot not served
  14. 12月编程语言排行榜出炉
  15. R语言dplyr包bind_cols函数把两个dataframe数据的列横向合并起来、最终列数为原来两个dataframe列数的加和(Combine Data Frames)
  16. 电脑插耳机有声音,扬声器没声音的解决方案(win10)
  17. Win7:如何部署定制的Quicklaunch图标
  18. 《富爸爸,穷爸爸》读后感——怎么实现财务自由
  19. Android安卓集成融云推送踩坑
  20. 梦想热气球创意手绘PPT模板

热门文章

  1. 使用lkjson处理Json数据
  2. [原创]如何有效的考核测试人员
  3. Java面试题视频讲解汇总,持续更新中...
  4. [sublime系列文章] sublime text 3构建系统
  5. 面向对象编程设计练习题(2)
  6. Jfinal3.4+layui2.4.3整合
  7. java集合框架之LinkedList
  8. 记录自己的心路文字~
  9. 循序渐进 OSPF的详细剖析(二)
  10. 「WTF系列」深入Java中的位操作