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. nodejs+Express中使用mustache模板引擎

    由于公司一个seo项目,需要我协助.此项目他人已经开发大半,由于seo需要,使用了服务器端模板引擎.我项目的后端同事说项目是go语音写的,跑项目麻烦,只给了我template和css等静态文件. 为了 ...

  2. git pull出错:cannot pull into a repository with state: merging_resolved"

    git pull 出错解放办法:1.尝试先提交现有代码到本地,再更新2.git reset —hard

  3. go 创建自己的区块

    package main import ( "time" "crypto/sha256" "bytes" ) //区块体 type Bloc ...

  4. CF1248F Catowice City

    题目链接 problem 有\(n\)个人,每个人家有一只猫.每个人都认识一些猫(其中肯定包括自己家的猫).选出\(j\)个人和\(k\)只猫\((j,k\ge 1)\).使得\(j+k=n\)且选出 ...

  5. 请不要嘲笑你身边那些投了P2P的朋友

    在这方面我是非常谨慎的,但依然逃脱不了翻车的命运 这段时间曾经无数大V强烈推荐的懒投资出现大面积逾期,又把这个行业推上了风口浪尖,这里讲一讲我的故事 对于大多数人的理财投资可能是从2013年余额宝的推 ...

  6. Net Core 3.0 尝鲜指南

    swagger .Net Core 3.0中的swagger,必须引用5.0.0 及以上版本.可以在Nuget官网查看版本.目前最新版本(2019-9-25) 5.0.0rc3 Install-Pac ...

  7. php date获取前一天的时间

    结果: 结论: 第二种方式只使用了一个函数,所以更快一些,速度大约是第一种的两倍

  8. 大话设计模式Python实现-职责链模式

    职责链模式(Chain Of Responsibility):使多个对象都有机会处理请求,从而避免发送者和接收者的耦合关系.将对象连成链并沿着这条链传递请求直到被处理 下面是一个设计模式的demo: ...

  9. 反射2-spring boot jpa 注入model即实现查询

    spring boot jpa 使用方法:将对应的model类注入即可// fixed parameter type private Specification<TargetModel> ...

  10. Vs Code 2019软件安装教程及常用的入门设置

    小编认为VsCode是一款非常好用的编辑器,插件丰富,支持的语言种类非常多.我所使用VsCode主要打一些前端的代码,自己感觉very good. 点击运行. 按图所示操作. 安装教程很简单的,主要是 ...