CodeforcesRound#178(Div.2)-A.ShaassandOskols_html/css_WEB-ITnose
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了CodeforcesRound#178(Div.2)-A.ShaassandOskols_html/css_WEB-ITnose,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含3076字,纯文字阅读大概需要5分钟。
内容图文
![CodeforcesRound#178(Div.2)-A.ShaassandOskols_html/css_WEB-ITnose](/upload/InfoBanner/zyjiaocheng/400/b299ba521bf543d4b6b2701a690c2162.jpg)
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output
Shaass has decided to hunt some birds. There are n horizontal electricity wires aligned parallel to each other. Wires are numbered 1 to nfrom top to bottom. On each wire there are some oskols sitting next to each other. Oskol is the name of a delicious kind of birds in Shaass's territory. Supposed there are ai oskols sitting on the i-th wire.
Sometimes Shaass shots one of the birds and the bird dies (suppose that this bird sat at the i-th wire). Consequently all the birds on the i-th wire to the left of the dead bird get scared and jump up on the wire number i?-?1, if there exists no upper wire they fly away. Also all the birds to the right of the dead bird jump down on wire number i?+?1, if there exists no such wire they fly away.
Shaass has shot m birds. You're given the initial number of birds on each wire, tell him how many birds are sitting on each wire after the shots.
Input
The first line of the input contains an integer n, (1?≤?n?≤?100). The next line contains a list of space-separated integers a1,?a2,?...,?an, (0?≤?ai?≤?100).
The third line contains an integer m, (0?≤?m?≤?100). Each of the next m lines contains two integers xi and yi. The integers mean that for the i-th time Shaass shoot the yi-th (from left) bird on the xi-th wire, (1?≤?xi?≤?n,?1?≤?yi). It's guaranteed there will be at least yi birds on thexi-th wire at that moment.
Output
On the i-th line of the output print the number of birds on the i-th wire.
Sample test(s)
input
510 10 10 10 1052 53 132 121 134 6
output
0125016
input
32 4 112 2
output
303
解题思路:有n排电线杆,第i个上面有ai只鸟,每次拿枪射杀第xi排的第yi只鸟,这只鸟肯定会死掉(没有意外),yi左边的鸟会全部飞到第 i-1 根电线杆上,如果是 i == 1,则那些鸟就飞走了;yi右边的鸟全都飞到了第 i+1 跟电线杆上,如果 i == n ,则那些鸟就全都飞走了。问开了m枪后,最后各个电线杆上的鸟数各是多少。
直接暴力一步一步做呗。貌似还没见到什么更好的方法。
AC代码:
#include#include #include #include #include #include #include #include
内容总结
以上是互联网集市为您收集整理的CodeforcesRound#178(Div.2)-A.ShaassandOskols_html/css_WEB-ITnose全部内容,希望文章能够帮你解决CodeforcesRound#178(Div.2)-A.ShaassandOskols_html/css_WEB-ITnose所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。