Sphere Online Judge

Computer geeks! Show off your skills and claim the job of your dreams! RecruitCoders.com

SPOJ Problem Set (classical)

3883. LATGACH3

Problem code: M3TILE

In how many ways can you tile a 3xn rectangle with 2x1 dominoes?

Here is a sample tiling of a 3x12 rectangle.

Input consists of several test cases followed by a line containing -1.
Each test case is a line containing an integer 0 ≤ n ≤ 30. For each test
case, output one integer number giving the number of possible tilings. 

SAMPLE INPUT

2
8
12
-1

SAMPLE OUTPUT

3
153
2131

Added by:~!(*(@*!@^&
Date:2009-02-17
Time limit:1s
Source limit:50000B
Languages:All except: ERL JS PERL 6
Resource:ACM

hide comments
2012-03-21 13:19:37 Sandy Akbar Dewangga
input 0 is tricky one -_-
2012-01-06 14:41:18 iwillambush
Had to think for this one !!
2011-07-08 15:54:47 cegprakash
enjoyed solving this :D
2010-06-17 17:02:52 .:: Debanjan ::.

Same Problem : http://acm.uva.es/p/v109/10918.html
2009-07-15 17:46:53 Przemysław Pietrzkiewicz
When n == 0, there is exactly ONE way of tiling - not using any dominoes at all.
2009-04-12 01:10:55 Michał Łukasiewicz
If the input number is 0 your program should output 1. I don't get it...

edit: i got acc considering there's no such case

Last edit: 2011-07-08 15:55:51
SPOJ System © 2012 Sphere Research Labs | Projekty informatyczne i aplikacje na zamówienie. All Rights Reserved.