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에 들어가는 값이 전구 패턴의 하나가 됩니다.
이렇게해서.. 순서에 상관없이, 중복돼지 않게 전구 패턴이 총 몇가지 경우의 수가 있는지 찾는 프로그램입니다.
도와주세요.. ㅜ
막막하네요..
번호 | 제 목 | 글쓴이 | 날짜 |
---|---|---|---|
2704529 | 메모리 동적 할당 관련해서 질문 있습니다~ | 궁수자리 | 2025-08-11 |
2704497 | int double char 같은것좀 좀만 더 가르쳐 주세요 (6) | 로지 | 2025-08-10 |
2704473 | 구조체 배열 초기화 질문 | 꽃은별 | 2025-08-10 |
2704445 | 배열과 조건문에 관한질문 (3) | 찬솔큰 | 2025-08-10 |
2704417 | 이진 트리 깊이 값 구하는것 질문입니다. | 푸른잎 | 2025-08-10 |
2704391 | 자료 유형에 관련된 문제입니다. (2) | 늘솜 | 2025-08-09 |
2704365 | c언어 문제안되서물어봅니다 (3) | 맑은가람 | 2025-08-09 |
2704338 | 다항식의 뺄셈에 대해 질문드립니다... (1) | 여자 | 2025-08-09 |
2704311 | 센서를 이용한 라인 주행인데 명령어좀 알려주세요 ㅠ_ㅠ (3) | 초록이 | 2025-08-09 |
2704284 | 배열for문;; (3) | 은솜 | 2025-08-08 |
2704255 | readline(int fd, char *buf, int nbytes)함수를 구현하는법좀..ㅠㅠ | 파라나 | 2025-08-08 |
2704196 | 간단한 c언어좀 만들어주세요 (2) | 슬S2아 | 2025-08-08 |
2704118 | 성적에서 등수 구하기 (4) | 딥레드 | 2025-08-07 |
2704062 | 알고리즘 알려주세요 | 나리 | 2025-08-06 |
2704035 | 답은 나오는데 과정에서 `` 약간 이상합니다.ㅎㅎ 답만나와버려요 | 핫블랙 | 2025-08-06 |
2703979 | 문자열 EEPROM 작성 방법 문의드립니다. | 그녀는귀여웠다 | 2025-08-06 |
2703954 | 키보드를 입력하면 캐릭터를 움직이기 질문 (7) | 좋아해 | 2025-08-05 |
2703924 | 계속 에러가... (4) | 눈꽃 | 2025-08-05 |
2703897 | 배열의 최댓값과 최솟값 차이 구하기 (1) | 하늬 | 2025-08-05 |
2703869 | C언어 질문입니다 급해용!!! ㅠㅠ (2) | 덕이 | 2025-08-05 |