CCCSENIOR2009년 문제 2번 질문입니다.
똥덩어리
cccsenior2009년 문제 2번 질문입니다.요약할 수가 없네요..질문 내용 : = =
problem s2: the lights going on and off
problem description
for your birthday, you have been given a grid of r (1 r 30) rows of lights, with each row
containing l (1 l 8) lights. lights can be in one of two states: on or off. for this question,
the topmost row is row r, and the bottom-most row is row 1. also, beside all rows except the
topmost row (row r), there is a button which can be pushed.
pushing the button beside row k (1 k r) will peform an “exclusive-or” operation on each
light of row k, which is described below. consider column i in row k, where 1 i l. if the
lights in column i of row k and column i of row k + 1 are both the same (i.e., both on, or both
off), then pushing the button beside row k will cause the light in column i of row k to be off. if the
lights in column i of row k and column i of row k + 1 are different (i.e., one is on, and the other is
off), then pushing the button beside row k will cause the light in column i of row k to be on. an
example is shown below, for l = 4:
column numbers 1 2 3 4
row k + 1 on on off off
row k before button pushed on off on off
row k after button pushed off on on off
you are told which lights are initially on and which are initially off. you must calculate how many
different light patterns are possible for the bottom row by any sequence of button pushes.
input description
the first line of input will contain the integer r, the number of rows. the second line of input
will contain the integer l, the number of lights per row. the next r lines of input will contain
l integers, where the integer will either be 0 (to indicate “off”) or 1 (to indicate ”on”). pairs of
consecutive integers will be separated by one space character. these r lines will be given in topdown
order: that is, the third line of input will be the description of row r, the fourth line will be
r 1, and so on, until the last line describes the bottom row.
output description
output the number of possible light patterns of the bottom row.
sample input
4
3
0 0 1
0 1 1
1 0 1
0 0 1
output for sample input
4
간단히 문제를 설명해드리자면.
r*l의 전구셋트가 있습니다.
1 r 30, 1 = l 8 이구요.
즉, r은 l만큼의 전구가 몇개있다 그거구요.
l은 한 줄에 전구 몇개다 입니다.
여기서, row 1은 제일 아래있는 줄을 뜻합니다.
row r이 제일 위에있는 줄을 뜻합니다.
여기서, row r을 제외한 나머지 row에는 모두 버튼이 있는데, 이 버튼을 누르면
row k를 눌럿을 시, row k = (row k) xor (row k+1) 이 연산을 수행하고, row k에 들어가는 값이 전구 패턴의 하나가 됩니다.
이렇게해서.. 순서에 상관없이, 중복돼지 않게 전구 패턴이 총 몇가지 경우의 수가 있는지 찾는 프로그램입니다.
도와주세요.. ㅜ
막막하네요..
번호 | 제 목 | 글쓴이 | 날짜 |
---|---|---|---|
2695122 | 구조체에 대해 물어보고 싶은게 있습니다 ^^^.. (7) | 수련 | 2025-05-17 |
2695091 | txt 파일 입출력 후 2차 배열에 저장하기입니다. (3) | 헛장사 | 2025-05-17 |
2695063 | 수도요금 프로그램좀 짜주세요. | 시내 | 2025-05-17 |
2695033 | 답변좀요ㅠㅠ (1) | 비사벌 | 2025-05-16 |
2695010 | C++의 STL은 왜 굳이 템플릿화 시켜서 라이브러리를 만드나요? (초보수준의 질문..) (2) | 엘보어 | 2025-05-16 |
2694958 | 로직이 변한다는 것에 대해서 궁금합니다. | 튼동 | 2025-05-16 |
2694929 | 열혈강의 25-2 두번째 문제 질문 | 지우개 | 2025-05-15 |
2694900 | dequeue 에서 리턴값 프린트 방법알려주세요 오늘 12시까지 대화방에 있습니다 도와주세요 | 미투리 | 2025-05-15 |
2694854 | 절대값을 구할때 (2) | 그녀는귀여웠다 | 2025-05-15 |
2694827 | 이제 어떻게 공부해야할지 모르겠네요 | 새얀 | 2025-05-14 |
2694778 | 순열 계산요. | 맛조이 | 2025-05-14 |
2694754 | ShowWindow 함수를 이용하려 하는데 질문있습니다. (2) | 파도 | 2025-05-14 |
2694731 | 리눅스 커널의 시작점 질문 | 미르 | 2025-05-13 |
2694702 | 이거 뭐가문제인가요 코드수정좀 (3) | 맑은 | 2025-05-13 |
2694675 | C언어 후위표기를 중위표기로 | 앨런 | 2025-05-13 |
2694646 | 안녕하세요 파일 합치기 함수! (1) | 연블루 | 2025-05-13 |
2694618 | 잘몰라서 설명부탁드립니다. scanf 관련 (3) | 파라 | 2025-05-12 |
2694590 | 이 코드가 뭐하는 코드일까요? #2 | 빵순 | 2025-05-12 |
2694559 | 동적할당으로 배열(2차원열)을 만드는데 있어 그걸 함수화시키는데... (1) | 늘솔길 | 2025-05-12 |
2694532 | 네트워크에 관하여... (4) | 황소자리 | 2025-05-12 |