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. KVM使用总结

    目录 一.虚拟化介绍 二.通过kvm安装centos7系统 三.常用操作 虚拟机列表 开关机 导出虚拟机 重命名 挂起&恢复 查看某个虚拟机对应的端口 kvm开机启动 console登陆(失败 ...

  2. 02. Go 语言基本语法

    Go语言基本语法 变量.数据类型和常量是编程中最常见,也是很好理解的概念.本章将从 Go 语言的变量开始,逐步介绍各种数据类型及常量. Go 语言在很多特性上和C语言非常相近.如果读者有C语言基础,那 ...

  3. jenkins报错:Problem accessing /jenkins/. Reason: HTTP ERROR 404

    这是一个Jenkins的Bug.临时解决方法是:在浏览器中手工输入:http://<ip>:<port>.不要访问"/jenkins"这个路径.

  4. spring cloud 2.x版本 Gateway熔断、限流教程

    前言 本文采用Spring cloud本文为2.1.8RELEASE,version=Greenwich.SR3 本文基于前两篇文章eureka-server.eureka-client.eureka ...

  5. 【TCP/IP网络编程】:01理解网络编程和套接字

    1.网络编程和套接字 网络编程与C语言中的printf函数和scanf函数以及文件的输入输出类似,本质上也是一种基于I/O的编程方法.之所以这么说,是因为网络编程大多是基于套接字(socket,网络数 ...

  6. 转载-SpringBoot结合线程池解决多线程问题实录;以及自己的总结

    原文地址:https://blog.csdn.net/GFJ0814/article/details/92422245 看看这篇文章(继续学习):https://www.jianshu.com/p/3 ...

  7. python保存文字到文件中

    使用encode方法即可,举例如下: #-*-coding:utf-8-*- def save(re, name): file = open("index_cut.txt", &q ...

  8. GALAXY OJ NOIP2019联合测试2-普及组

    概要: 今天比了个赛,还挺水,只不过不太理想. 题目: Problem : 韬韬抢苹果 又到了收获的季节,树上结了许多韬韬,错了,是许多苹果,有很多个小韬韬都来摘苹果.每个韬韬都想要最大的苹果,所以发 ...

  9. SpringMVC学习笔记一(请求流程和配置,启动项目)

    springmvc请求流程: 1.用户发送请求至前端控制器DispatcherServlet 2.DispatcherServlet收到请求调用HandlerMapping处理器映射器. 3.处理器映 ...

  10. Spring之 JDBC 异常

    JDBC异常抽象 Spring会将数据操作的异常转换为DataAccessException 解析错误码 SQLErrorCodeSQLExceptionTranslator ErrorCode定义 ...