JDOJ1178:铺地板II

https://neooj.com/oldoj/problem.php?id=1178

题目描述

用1 x 1和2 x 2的磁砖不重叠地铺满N x 3的地板,共有多少种方案?

输入

读入一个数N。1<=N<=1000。

输出

将答案输出。由于结果可能很大,你只需要输出这个答案mod 12345的值。

样例输入

2

样例输出

3
 
是3007铺地板的一个拓展,更加高级了一些的递推,然而还是没有什么思维含量(错了好几次的我很汗颜)
递推理解好了对动态规划有益处,希望大家好好理解。
#include<stdio.h>
int a[];
int main()
{
int n;
a[]=;
a[]=;
a[]=;
scanf("%d",&n);
for(int i=;i<=n;i++)
a[i]=(a[i-]+a[i-]*)%;
printf("%d",a[n]);
return ;
}

JDOJ1178:铺地板II的更多相关文章

  1. Leetcode 笔记 113 - Path Sum II

    题目链接:Path Sum II | LeetCode OJ Given a binary tree and a sum, find all root-to-leaf paths where each ...

  2. Leetcode 笔记 117 - Populating Next Right Pointers in Each Node II

    题目链接:Populating Next Right Pointers in Each Node II | LeetCode OJ Follow up for problem "Popula ...

  3. 函数式Android编程(II):Kotlin语言的集合操作

    原文标题:Functional Android (II): Collection operations in Kotlin 原文链接:http://antonioleiva.com/collectio ...

  4. 统计分析中Type I Error与Type II Error的区别

    统计分析中Type I Error与Type II Error的区别 在统计分析中,经常提到Type I Error和Type II Error.他们的基本概念是什么?有什么区别? 下面的表格显示 b ...

  5. hdu1032 Train Problem II (卡特兰数)

    题意: 给你一个数n,表示有n辆火车,编号从1到n,入站,问你有多少种出站的可能.    (题于文末) 知识点: ps:百度百科的卡特兰数讲的不错,注意看其参考的博客. 卡特兰数(Catalan):前 ...

  6. [LeetCode] Guess Number Higher or Lower II 猜数字大小之二

    We are playing the Guess Game. The game is as follows: I pick a number from 1 to n. You have to gues ...

  7. [LeetCode] Number of Islands II 岛屿的数量之二

    A 2d grid map of m rows and n columns is initially filled with water. We may perform an addLand oper ...

  8. [LeetCode] Palindrome Permutation II 回文全排列之二

    Given a string s, return all the palindromic permutations (without duplicates) of it. Return an empt ...

  9. [LeetCode] Permutations II 全排列之二

    Given a collection of numbers that might contain duplicates, return all possible unique permutations ...

随机推荐

  1. python的路径问题

    ## 文件路径出错问题 """ 如何获取与当前文件相关的地址 """ import os # 当前文件的完整路径 print(__file_ ...

  2. MVC、MTV、FBV、CBV、母版和继承:

    cookie session cookie的定义: 保存在浏览器上的一组组键值对 (请求头) 为什么要有? http协议是无状态,每次的请求之间是相互独立的,没有办法保存状态. Django中操作co ...

  3. Paper | PyTorch: An Imperative Style, High-Performance Deep Learning Library

    目录 0. 摘要 1. 简介 2. 背景 3. 设计原则 4. 针对易用性的核心设计 4.1 让深度学习模块不过是Python程序 4.2 互用性和可拓展性 4.3 自动差分 5. 针对高性能的PyT ...

  4. 反射(hasattr和getattr和setattr和delattr)

    目录 一.反射在类中的使用 1.1 应用 二.反射在模块中的使用 2.1 前言 2.2 反射机制 2.2.1 getattr() 2.2.2 hasattr(object, name) 2.2.3 s ...

  5. thinkphp5.1单模块设置

    thinkphp5.1单模块 1. // 是否支持多模块'app_multi_module' => false, // 自动搜索控制器'controller_auto_search' => ...

  6. python集合、元组、字典

    主要内容: 2.集合 3.元组 4.字典 复习: 字符串和元组一样,只能读不能写.列表和字典可以嵌套任何东西,列表可以嵌套列表 L = list("hello")  # L = [ ...

  7. H5混合应用之X5内核

    一.X5内核介绍 X5内核是腾讯公司基于优秀开源 webkit 深度优化的浏览器渲染引擎,并且在2014年正式宣布开放给app开发者,所以现在可以在很多app上看到都是使用的X5内核实现Hybrid混 ...

  8. struts2文件上传报错

    说明上传的文件为空,检查上传文件名

  9. c#汉字转拼音首字母全拼支持多音字

    1.首先在NuGet安装pingyinConverter 2.下载-安装-引用ChineseChar.dll到项目中 官网了解:http://www.microsoft.com/zh-cn/downl ...

  10. Django JsonResponse 不自动设置 cookie 的解决方案

    [背景] 目前在做一个前后端分离的 web 项目,后端使用的是 django 框架,所有的 API 都只返回 json :就在这个过程中遇到了一个问题,那就是对于所有的 JsonResponse dj ...