描述

A heap is a full binary tree; for each node, its key is greater than its two sub-node’s key. Two heaps are different if there are two nodes which have different keys at the same location. Now we have a problem for you: tell me how many different N-Nodes heaps we can make with N integers?

输入

There are many test cases; for each test case, one line contains only one integer N (1<=N<=1000000) indicating how many nodes the heap has.

输出

For each test case, output one line contains an integer indicating the number of the kinds of the heaps. Because the result might be very large, you can just output the result modular 20000003.

样例输入

1
2
3

样例输出

1
1
2

#include<iostream>
#include<cstdio>
#define MX 1000010
using namespace std;
__int64 a[MX];
int main()
{
__int64 i;
__int64 n=5;
a[1]=1;a[2]=1;
for(i=3;i<MX-1;i++)
a[i]=(a[i-1]+a[i-2])%20000003;
while(~scanf("%lld",&n))
{
// cout<<a[n]<<endl;
printf("%lld\n",a[n]);
}
return 0;
}

最新文章

  1. 虚拟机Ubuntu14/15启用root用户登录
  2. Android TabActivity中onKeyDown无效问题
  3. 微服务架构:Eureka集群搭建
  4. 使用Zend OpCache 提高 PHP 5.5+ 性能
  5. Java Script基础(十二) 正则表达式
  6. Python 多进程
  7. ionic 图片轮播问题
  8. hibernate 单元测试 5.2
  9. Debian/Ubuntu 已安装gcc/g++ 4.8.1
  10. 开源的.Net ORM微型框架SuperHelper
  11. LiteIDE灰调配色方案
  12. spring Cloud 域名映射 ip地址实现
  13. 二维数组的最大子数组和 时间复杂度:O(n的四次方)
  14. shell脚本学习-变量
  15. pdf及word文档的读取 pyPDF2,docx
  16. day02-数据库操作
  17. Redis阅读目录
  18. WDCP上传SSL证书
  19. pcap学习
  20. Delphi7卸载indy9,安装indy10步骤

热门文章

  1. ajax 简单操作
  2. UVA 674 Coin Change(dp)
  3. 解决centos7安装wmwaretools找不到kernel header
  4. YIi配置debug工具、yii配置gii工具
  5. Python:爬取乌云厂商列表,使用BeautifulSoup解析
  6. Python 模块(八) socketserver 以及 线程、进程
  7. Pick-up sticks(判断两直线相交)
  8. 正确的lnamp支持SSI的方法!即支持SHTML和include调用!
  9. HDU 5091 线段树扫描线
  10. 卸载了PL/SQL Developer,说一下与Toad for Oracle的对照