// The first problem is too easy to write its solution // The second problem of the test held on 13 November was taken from // the assignment 7 which was held on Wednesday. // The solution of the third problem is provided below. // It is not well documented. Please read the file analysis.pdf // for its underlying logic. // The test cases and grading policy for the test are mentioned in the // file test_cases_Thu.pdf (gradingpolicy is on the last page). class right_tilings { public static int M(int n) { if(n==0) return 1; else return (E(n) + N(n-1)); } public static int N(int n) { if(n==0) return 1; else { if(n==1) return 2; else return (C(n) + O(n-1)); } } public static int O(int n) { if(n==1) return 1; else return (M(n-1)+O(n-1)); } public static int C(int n) { if(n==0) return 1; else { if(n==1) return 2; else return (D(n-1) + 2*D(n-2) + C(n-2) + M(n-1)); } } public static int D(int n) { if(n==0) return 1; else { if(n==1) return 2; else return (D(n-1) + 2*D(n-2) + 2*C(n-2) + E(n-1)); } } public static int E(int n) { if(n==0) return 1; else { if(n==1) return 2; else return (D(n-1) + 2*D(n-2) + 2*N(n-2) + E(n-1)); } } public static void main(String args[]) { int n = Integer.parseInt(args[0]); int total_count = D(n); System.out.println("Total number of possible tilings= "+total_count); } }