Ural 1787. Turn for MEGA
来源:互联网 发布:python raw_input 编辑:程序博客网 时间:2024/06/02 16:09
1787. Turn for MEGA
Time limit: 1.0 second
Memory limit: 64 MB
Memory limit: 64 MB
A traffic light at the turn for the “MEGA” shopping center from the Novomoskovskiy highway works in such a way that k cars are able to take a turn in one minute. At weekends all the residents of the city drive to the mall to take a shopping, which results in a huge traffic jam at the turn. Administration of the mall ordered to install a camera at the nearby bridge, which is able to calculate the number of cars approa
ching this turn from the city. The observation started n minutes ago. You should use the data from the camera to determine the number of cars currently standing in the traffic jam.
ching this turn from the city. The observation started n minutes ago. You should use the data from the camera to determine the number of cars currently standing in the traffic jam.
Input
The first line contains integers k and n (1 ≤ k, n ≤ 100), which are the number of cars that can take a turn to “MEGA” in one minute and the number of minutes passed from the beginning of observation. The second line contains space-separated integers a1, …, an (0 ≤ ai ≤ 100), where aiis the number of cars that approached the turn during the i-th minute. The observation started at morning, when there were no cars at the turn.
Output
Output the number of cars currently standing in the traffic jam.
Samples
5 36 7 2
0
5 320 0 0
5
Problem Author: Bulat Zaynullin
Problem Source: Ural Regional School Programming Contest 2010
Problem Source: Ural Regional School Programming Contest 2010
每分钟可以通过k辆车
问n分钟后路上有几辆车
var n,k:integer;var num:integer;var ans:integer;var i:integer;beginread(k,n);ans:=0;for i:=1 to n dobeginread(num);ans:=ans+num-k;if(ans<0) then ans:=0;end;writeln(ans);end.
var n,k:integer;var num:integer;var ans:integer;var i:integer;beginread(k,n);ans:=0;for i:=1 to n dobeginread(num);ans:=ans+num-k;if(ans<0) then ans:=0;end;writeln(ans);end.
0 0
- Ural 1787. Turn for MEGA
- URAL 1787. Turn for MEGA
- URAL 1787 Turn for MEGA (贪心 + 模拟)
- Timus 1787. Turn for MEGA 题解
- turn page for ngui
- ural 1933 Guns for Battle!
- URAL 1933 Guns for Battle!
- URAL 2005. Taxi for Programmers
- URAL 1933 Guns for Battle!
- Paid For Pictures - Turn Your Camera Into Cash!
- Turn off Mobile View for SharePoint 2010 and SharePoint 2013
- ural 1613. For Fans of Statistics
- ural 1692 Flags for Provinces 解题报告
- Ural 1613. For Fans of Statistics
- ural 1613. For Fans of Statistics
- Ural 1540. Battle for the Ring
- Ural 1613 For Fans of Statistics
- Ural 1613-For Fans of Statistics(vector)
- redhat挂载镜像安装程序
- 解决samba没有smbpasswd文件
- GetAdaptersInfo获取MAC地址
- 简单爬虫
- 为什么我要与广告死掐
- Ural 1787. Turn for MEGA
- Android中定时执行任务的3种实现方法
- 在Xcode 6中将你的项目本地化
- random walk
- 分析iOS Crash文件:符号化iOS Crash文件的3种方法(转修)
- cocos2dx 编译出错
- 用SQLyogEnt备份恢复数据库问题
- ssh-keygen 用法
- 三款经典了国内萨迪克个你sad控股那事大法官