Blink
의견: 0
Unhappy with the dim lighting in his barn, Farmer John has just installed a fancy new chandelier consisting of N (3 <= N <= 16) light bulbs arranged in a circle.
The cows enjoy playing the following game: at time T, they toggle the state of each light bulb if its neighbor to the left was turned on at time T-1. They continue this game for B units of time (1 <= B <= 10^15). Note that B might be too large to fit into a standard 32-bit integer.
Given the initial states of the light bulbs, please determine their final states after B units of time have elapsed.
Line 1: Two space-separated integers, N and B.
Lines 2..1+N: Line i+1 contains the initial state of bulb i, either 0 (off) or 1 (on).
Lines 1..N: Line i should contain the final state of bulb i, either 0 (off) or 1 (on).
blink.inblink.out5 6
1
0
0
0
01
1
1
0
1Input details: There are five light bulbs. The first is initially on, the others off.
riseoj 작성
출처 올림피아드 > USACO > 2012-2013 > US Open > Bronze
평가 및 의견
Blink
Log in to rate problems.
아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.
풀이 제출
Blink