`
zsybupt
  • 浏览: 41590 次
  • 性别: Icon_minigender_1
社区版块
存档分类
最新评论

boj 85

    博客分类:
  • oj
 
阅读更多

Description

 

Once upon a time,there's a boy whose name is lili.He likes to create many wonderful things.One day, he happens to come to a beautiful garden.There he picks many pretty little stones.Again,his heart tells him that he should use them to create some incredible things!So he decides to put them in a line of boxes,each box has at most one stone,just as the road which he used to walk on in his childhood.But again,he wants to make his works different.So he wants no two adjacent boxes to have stones both.He wonders how many ways that stones be put into boxes.Can you help him to finish his great work?

Input 

multiple cases:

n(0<=n<=100000)the number of the boxes

Output

The number described above MOD 10007.

Sample Input

0

1

Sample Output

1

2

Source

lili 

 

代码:

#include<iostream>
using namespace std;
int arr[100002];
int main()
{
	int n;
	arr[0]=1;
	arr[1]=2;
	for(int i=2;i<=100000;i++)
		arr[i]=(arr[i-1]+arr[i-2])%10007;
	while(~scanf("%d",&n))
		printf("%d\n",arr[n]);
}

 

分享到:
评论

相关推荐

    BOJ题目1023. Ancient Keyboard 源代码

    BOJ的题目1023. Ancient Keyboard解法 源代码

    boj 0809复试模拟题答案

    boj 上08 09 年复试模拟题的答案

    boj:算法

    boj:算法

    JAVA_BOJ

    JAVA_BOJ

    Algorithm-BOJ.zip

    Algorithm-BOJ.zip,BekJon在线法官(Java,Kotlin,SWIFT)和PS路线图,算法是为计算机程序高效、彻底地完成任务而创建的一组详细的准则。

    BOJ

    BOJ

    Algorithm-BOJ-PSJ.zip

    Algorithm-BOJ-PSJ.zip,Baykon在线判断JAVA问题解决方法(第二章),算法是为计算机程序高效、彻底地完成任务而创建的一组详细的准则。

    Algorithm-BOJ-AutoCommit.zip

    Algorithm-BOJ-AutoCommit.zip,当您解决baekjoon online judge的问题时,它会自动提交并推送到远程存储库。,算法是为计算机程序高效、彻底地完成任务而创建的一组详细的准则。

    Algorithm-boj-auto-submit.zip

    Algorithm-boj-auto-submit.zip,日本央行cli提交脚本,算法是为计算机程序高效、彻底地完成任务而创建的一组详细的准则。

    Python库 | boj-0.0.1.tar.gz

    资源分类:Python库 所属语言:Python 资源全名:boj-0.0.1.tar.gz 资源来源:官方 安装方法:https://lanzao.blog.csdn.net/article/details/101784059

    Boj Coloring Book-crx插件

    通过这本图画书展示您的创造力,其中包括Boj和朋友。 一本有趣的,全数字化且可重复使用的着色书,可用于 通过这本图画书展示您的创造力,其中包括Boj和朋友。 一本有趣的全数字可重复使用的图画书,专为孩子,父母...

    boj.kr:解决boj.kr的问题

    解决问题 Boj.kr

    BOJ:日本央行

    BOJ:日本央行

    boj:算法求解

    boj:算法求解

Global site tag (gtag.js) - Google Analytics