黑龙江省第七届大学生程序设计竞赛-Heap
描述
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.
样例输入
2
3
样例输出
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;
}
黑龙江省第七届大学生程序设计竞赛-Heap的更多相关文章
- 黑龙江省第七届大学生程序设计竞赛-Mysterious Organization
描述 GFW had intercepted billions of illegal links successfully. It has much more effect. Today, GFW i ...
- “亚信科技杯”南邮第七届大学生程序设计竞赛之网络预赛 A noj 2073 FFF [ 二分图最大权匹配 || 最大费用最大流 ]
传送门 FFF 时间限制(普通/Java) : 1000 MS/ 3000 MS 运行内存限制 : 65536 KByte总提交 : 145 测试通过 : 13 ...
- 2015湘潭市第七届大学生程序设计竞赛 —— Fraction
题目大意: 小数化分数,但是分母限制在[1,1000],很明显的枚举,但是在赛场上的时候傻逼了,无论怎么枚举,怎么二分就是wa,wa到死···········. (ps:我要给出题人寄刀片~~~~), ...
- 《内蒙古自治区第十三届大学生程序设计竞赛试题_H 公孙玉龙》
这个题有点小坑,最坑的地方就是 输入的b 变量 有可能 是 负数 ! 负数 ! 负数! 对 ,你没有看错,就是负数,坑死我了, 一直都是 content.charAt(0) 判断 ...
- 浙江财经大学第十五届大学生程序设计竞赛------B 烦恼先生打麻将
问题 B: B - 烦恼先生打麻将 时间限制: 1 Sec 内存限制: 256 MB提交: 8 解决: 5[提交][状态][讨论版] 题目描述 输入 6 6 Z D 1S 1S 9W 5W 2S ...
- ZOJ 4100 浙江省第16届大学生程序设计竞赛 A题 Vertices in the Pocket 线段树+并查集
正赛的时候完全没看这个题,事后winterzz告诉我他想出来的解法. 首先题意是给出n个点,m次操作. 操作有一种是连接两个点,另一种是求此时再为这个图连k条边,最少和最多能有几个联通块. 最少的求法 ...
- River Crossing---河南省第六届大学生程序设计竞赛
题目描述 Afandi is herding N sheep across the expanses of grassland when he finds himself blocked by a ...
- ZOJ 4103 浙江省第16届大学生程序设计竞赛 D题 Traveler 构造
这个题,正赛的时候也没有过,不过其实已经有了正确的解法,可惜时间不多了,就没有去尝试. 题意是有n个点,i点能通向i-1,然后i和i*2.i*2+1互通. 请你构造一种路径从1能走完所有点,并且不重复 ...
- Contest - 中南大学第六届大学生程序设计竞赛(Semilive)
题1:1160十进制-十六进制 注意他给的数据范围 2^31,int是 2^31-1 #include<iostream> using namespace std; int main() ...
随机推荐
- Angular JS 学习笔记(一)
1. 菜鸟教程:http://www.runoob.com/angularjs/angularjs-tutorial.html 2. Angular JS中文网:http://www.apjs.net ...
- [译]Stairway to Integration Services Level 9 - Control Flow Task Errors
介绍 在本文中,我们会实验 MaximumErrorCount和ForceExecutioResult 故障容差属性,并且还要学习Control Flow task errors, event han ...
- CodeForce 569A
Time Limit:2000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64u Description Litt ...
- 模仿jquery的一些实现
wylUtil.js //w作为window的形参,就表示window (function(w) { // 定义一个全局的window.wyl变量,就类似于jquery里的$,Jquery对象 w.w ...
- IDEA 16注册
License server,直接输入http://www.iteblog.com/idea/key.php地址即可激活IntelliJ IDEA
- bash:xxx:command not found
前几天在centos6.0上配好了oracle 10g并且能够执行oracle相关命令,但是今天准备往oracle里倒数据时,执行sqlplus 出现bash:command not found [o ...
- 一維條碼編碼規則(1D Barcode)
1.Code 39 條碼:又分 標準型Code 39 條碼(Standard Code 39):資料內容包含有0~9數字,A~Z英文字母,”+”,”-“,”*”,”/”,”%”,”$”,”.”以及sp ...
- Javascript-one
今天,学习Javascript第一天,学习了一些基本的概念,下面就对今天所学的知识进行一个整理,回顾吧! 首先,将Javascript代码包含在(X)html文档中,主要的方法是使用<scrip ...
- VMware Workstation9安装Mac OS X10.9系统
链接地址:http://jingyan.baidu.com/article/aa6a2c142cef740d4c19c426.html VMware Workstation9.0安装Mac OS X1 ...
- C++静态成员函数和静态成员变量的探索
静态数据成员属于类,非属于类对象,所以,定义位置就有了限制. 静态数据成员要实际地分配空间,故不能在类的声明中定义(只能声明数据成员).类声明只声明一个类的“尺寸和规格”,并不进行实际的内存分配,所以 ...