日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

URAL 1787. Turn for MEGA

發布時間:2024/8/1 编程问答 38 豆豆
生活随笔 收集整理的這篇文章主要介紹了 URAL 1787. Turn for MEGA 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

1787. Turn for MEGA

Time limit: 1.0 second
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 approaching 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

input output
5 3 6 7 2 0
5 3 20 0 0 5


題的大概意思就是在一個路口,每分鐘可以有k輛車轉頭,n分鐘內分別有ai輛車通過,輸出有多少車滯留。
剛開始想的太簡單了,直接用了個sum把ai全加起來和k*n比較,后來發現下一分鐘接近路口的車不能出現在上一分鐘里。
#include<cstdio> #include<iostream> using namespace std; int main() {int k,n,sum;int a[1001];while(cin>>k>>n){sum=0;for(int i=0;i<n;i++){cin>>a[i];if(sum+a[i]>k)sum+=a[i]-k;elsesum=0;}cout<<sum<<endl;}return 0; }

總結

以上是生活随笔為你收集整理的URAL 1787. Turn for MEGA的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。

主站蜘蛛池模板: 中文字幕一区二区三区视频 | 操丝袜美女视频 | 蜜臀999| 污污的网站在线观看 | 麻豆精品在线播放 | 一女被多男玩喷潮视频 | 国产免费成人在线视频 | 肉大捧一进一出免费视频 | 日韩精品免费观看 | 日本xxxxwwwww | 欧美性大战久久久久久久 | 欧美理论片在线观看 | 欧美熟妇久久久久 | 日皮视频免费看 | 男男免费视频 | 免费三级大片 | 小视频在线观看 | 无码人妻精品一区二区三应用大全 | 久久久久久国产精品视频 | 亚洲妇女体内精汇编 | 日本一区二区三区在线免费观看 | 少妇一级片 | 国产精品成人免费一区二区视频 | 四虎影院在线观看免费 | 亚洲激情视频在线播放 | 国产一区二区不卡 | 美女扣逼喷水视频 | 国产精品人人 | 99精品视频免费 | 日韩中文免费 | 精品乱子伦 | 99在线看 | 亚洲熟妇毛茸茸 | 无码一区二区三区在线观看 | 8x8ⅹ国产精品一区二区二区 | av毛片在线 | 91福利网站 | 久久久精品一区二区三区 | 亚洲美女一区 | 一区二区三区四区久久 | 就爱啪啪网 | av免播放器 | 国产黄a三级三级三级看三级男男 | 国产精品第二十页 | www.黄色片网站 | h片网站在线观看 | 国产精品女人久久久 | 人妻洗澡被强公日日澡 | www亚洲视频| 99在线看 | 亚洲最大视频网 | 中文人妻熟妇乱又伦精品 | 国产成人一区二区 | 涩涩视频在线免费看 | 国产二区精品 | 韩国美女一区 | 人妻熟妇又伦精品视频a | 久久久香蕉视频 | 中文字幕一区视频 | 免费成人美女在线观看. | 成人自拍视频在线观看 | 在线黄色网 | 最新的av网站| 福利一区二区在线 | 久久激情综合 | 操操日日 | www国产亚洲精品久久网站 | 国产无遮挡又黄又爽免费视频 | 性欧美巨大乳 | 国产视频精品久久 | 久久午夜免费视频 | 欧美久久久久久久久久久 | 国语对白清晰刺激对白 | 一区国产在线 | 在线免费观看亚洲 | 久久精品视频免费观看 | 欧美激情喷水 | 性一交一乱一区二区洋洋av | 精品动漫一区二区三区在线观看 | а√天堂资源在线 | 亚洲伦理一区二区 | 久久av网址 | 福利91 | 天堂俺去俺来也www久久婷婷 | 久久久久成人精品免费播放动漫 | 日本jizz在线观看 | 成人hd| 夜夜春av| 人操人视频 | 日本美女a级片 | 日本五十路女优 | 国产一区二区小说 | 欧美女优一区 | 国产欧美精品在线 | 精品国产乱码久久久久久闺蜜 | 中文字幕乱码一区二区 | 欧美亚洲综合一区 | 国产精品日韩欧美一区二区三区 | 国产综合视频一区二区 |