Hungry Cow
시간 제한: 6000ms메모리 제한: 1024MB출처: USACO 2023 February PlatinumBOJ 27840
문제
Bessie is a hungry cow. Each day, for dinner, if there is a haybale in the barn, she will eat one haybale. Farmer John does not want Bessie to starve, so some days he sends a delivery of haybales, which arrive in the morning (before dinner). In particular, on day , Farmer John sends a delivery of haybales (, ).
Process () updates as follows: Given a pair , update the number of haybales arriving on day to . After each update, output the sum of all days on which Bessie eats haybales modulo .
입력
, followed by lines containing the updates.
출력
The sum after each update modulo .
예제
예제 1
입력
3 4 3 1 5 1 2
출력
15 36 18
예제 2
입력
9 1 89 30 7 101 26 1 24 5 1 60 4 5 10 101 0 1 200
출력
4005 4656 7607 3482 3507 3753 4058 1107 24531
코드를 제출하려면 로그인하세요.