Logo
(追記) (追記ここまで)

4112번 - Mosaic 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB428820.513%

문제

An architect wants to decorate one of his buildings with a long, thin mosaic. He has two kinds of tiles available to him, each 2 inches by 2 inches:

He can rotate the second kind of tile in any of four ways. He wants to fill the entire space with tiles, leaving no untiled gaps. Now, he wonders how many different patterns he can form. He considers two mosaics to be the same only if they have exactly the same kinds of tiles in exactly the same positions. So, if a rotation or a reflection of a pattern has tiles in different places than the original, he considers it a different pattern. The following are examples of 4” x 16” mosaics, and even though they are all rotations or reflections of each other, the architect considers them to be four different mosaics:

입력

There will be several test cases. Each test case will consist of two integers on a single line, N and M (2 ≤ N ≤ 10, 2 ≤ M ≤ 500). These represent the dimensions of the strip he wishes to fill, in inches. The data set will conclude with a line with two 0's.

출력

For each test case, print out a single integer representing the number of unique ways that the architect can tile the space, modulo 106. Print each integer on its own line, with no extra whitespace. Do not print any blank lines between answers.

제한

예제 입력 1

2 10
4 16
4 50
0 0

예제 출력 1

25
366318
574777

힌트

출처

ICPC > Regionals > North America > Southeast USA Regional > 2009 Southeast USA Regional Programming Contest I번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /