ACM学习历程——HDU4472 Count(数学递推) (12年长春区域赛)
Description
The result might be very large, so you should take module operation with modules 10 9 +7 before print your answer. Input
Output
Sample Input
Sample Output
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <string>
#define N 1000000007 using namespace std; int ans[1005];
int n; void qt ()
{
memset (ans, 0, sizeof (ans));
ans[1] = 1;
for (int i = 2; i <= 1000; ++i)
{
for (int j = 1; j < i; ++j)
{
if ((i-1) % j == 0)
ans[i] = (ans[i] + ans[j]) % N;
}
}
} int main()
{
//freopen ("test.txt", "r", stdin);
qt ();
int times = 1;
while (scanf ("%d", &n) != EOF)
{
printf ("Case %d: %d\n", times++, ans[n]);
}
return 0;
}
ACM学习历程——HDU4472 Count(数学递推) (12年长春区域赛)的更多相关文章
- ACM学习历程—HDU5396 Expression(递推 && 计数)
Problem Description Teacher Mai has n numbers a1,a2,⋯,an and n−1 operators("+", "-&qu ...
- ACM学习历程—HDU 5446 Unknown Treasure(数论)(2015长春网赛1010题)
Problem Description On the way to the next secret treasure hiding place, the mathematician discovere ...
- ACM学习历程—HDU 5025 Saving Tang Monk(广州赛区网赛)(bfs)
Problem Description <Journey to the West>(also <Monkey>) is one of the Four Great Classi ...
- ACM学习历程——HDU5017 Ellipsoid(模拟退火)(2014西安网赛K题)
---恢复内容开始--- Description Given a 3-dimension ellipsoid(椭球面) your task is to find the minimal distanc ...
- 2015年ACM长春区域赛比赛感悟
距离长春区域赛结束已经4天了,是时候整理一下这次比赛的点点滴滴了. 也是在比赛前一周才得到通知要我参加长春区域赛,当时也是既兴奋又感到有很大的压力,毕竟我的第一场比赛就是区域赛水平,还是很有挑战性的. ...
- ACM学习历程——ZOJ 3822 Domination (2014牡丹江区域赛 D题)(概率,数学递推)
Description Edward is the headmaster of Marjar University. He is enthusiastic about chess and often ...
- ACM学习历程—UESTC 1217 The Battle of Chibi(递推 && 树状数组)(2015CCPC C)
题目链接:http://acm.uestc.edu.cn/#/problem/show/1217 题目大意就是求一个序列里面长度为m的递增子序列的个数. 首先可以列出一个递推式p(len, i) = ...
- ACM学习历程—HDU1041 Computer Transformation(递推 && 大数)
Description A sequence consisting of one digit, the number 1 is initially written into a computer. A ...
- ACM学习历程—HDU1028 Ignatius and the Princess III(递推 || 母函数)
Description "Well, it seems the first problem is too easy. I will let you know how foolish you ...
随机推荐
- Battery Charging Specification 1.2 中文详解
转: http://blog.csdn.net/liglei/article/details/228 1. Introduction 1.1 Scope 规范定义了设备通过USB端口充电的 ...
- spring中的事件 applicationevent 讲的确实不错
event,listener是observer模式一种体现,在spring 3.0.5中,已经可以使用annotation实现event和eventListner里. 我们以spring-webflo ...
- kotlin 语言入门指南(一)--基础语法
基于官网的Getting Start的基础语法教程部分,一共三节,这篇是第一节,翻译如下: 基础语法 定义一个包 包的声明必须放在文件头部: package my.demo import java.u ...
- HDFS源码分析心跳汇报之数据块增量汇报
在<HDFS源码分析心跳汇报之BPServiceActor工作线程运行流程>一文中,我们详细了解了数据节点DataNode周期性发送心跳给名字节点NameNode的BPServiceAct ...
- JAVA使用并行流(ParallelStream)时要注意的一些问题
https://blog.csdn.net/xuxiaoyinliu/article/details/73040808
- 01 http协议概念及工作流程
一:HTTP协议 重要性: 无论是以后用webserverice ,还是用rest做大型架构,都离不开对HTTP协议的认识. 甚至可以简化的说: webservice = http协议+XML Res ...
- RPMBUILD源码打包资源汇总(转)
http://mattshma.github.io/2015/11/04/rpm%E6%89%93%E5%8C%85/ http://400053.blog.51cto.com/390053/7210 ...
- 有状态的EJB对象和无状态的EJB对象
一,定义有状态Bean和无状态Bean 有状态Bean: @Stateful @Remote public class StatefulEjbBean implements StatefulEjb{ ...
- node.js的http模块的基础 学到的东西
node.js的http模块的基础 学到的东西 其中客户端:我们在node.js中如果要请求服务端中的js或者其他脚本的话要使用http.request()方法他会返回http.ClientReque ...
- iOS开发 僵尸调试
本文转载至 http://blog.sina.com.cn/s/blog_a843a8850101dxin.html 引自:http://blog.csdn.net/likendsl/articl ...