hdu 1005
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1005
思路:找规律题
#include<stdio.h>
main()
{
int s[];
int a,b,n,i;
while(scanf("%d%d%d",&a,&b,&n)!=EOF&&(a||b||n))
{
s[]=;
s[]=;
for(i=;i<=;i++)
{
s[i]=(a*s[i-]+b*s[i-])%;
}
printf("%d\n",s[n%]);
}
return ;
}
hdu 1005的更多相关文章
- HDU 1005 Number Sequence(数列)
HDU 1005 Number Sequence(数列) Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Jav ...
- HDU 1005(周期问题)
HDU 1005 Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u Descript ...
- HDU 1005 Number Sequence(数论)
HDU 1005 Number Sequence(数论) Problem Description: A number sequence is defined as follows:f(1) = 1, ...
- HDU - 1005 Number Sequence 矩阵快速幂
HDU - 1005 Number Sequence Problem Description A number sequence is defined as follows:f(1) = 1, f(2 ...
- HDU 1005 Number Sequence【多解,暴力打表,鸽巢原理】
Number Sequence Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)T ...
- HDU 1005 Number Sequence:矩阵快速幂
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1005 题意: 数列{f(n)}: f(1) = 1, f(2) = 1, f(n) = ( A*f(n ...
- 51nod 1126 求递推序列的第N项 && hdu - 1005 Number Sequence (求周期)
http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1126 http://acm.hdu.edu.cn/showproblem ...
- hdu 1005 Number Sequence(矩阵连乘+二分快速求幂)
题目:http://acm.hdu.edu.cn/showproblem.php?pid=1005 代码: #include<iostream> #include<stdio.h&g ...
- HDU 1005 Wooden Sticks
http://acm.hdu.edu.cn/showproblem.php?pid=1051 Problem Description There is a pile of n wooden stick ...
随机推荐
- C++ stringstream
C++ 引入了ostringstream.istringstream.stringstream这三个类,这三个类包含在sstream.h头文件中.三个类中 1)istringstream类用于执行C+ ...
- web服务器页面错误代码集
HTTP 1xx-信息提示 这些状态代码表示临时的响应.客户端在收到常规响应之前,应准备接收一个或多个1xx响应. 100-继续. 101-切换协议. 2xx-成功 这类状态代码表明服务器成功地接受了 ...
- word20161204
CA, certification authority / 证书颁发机构 cache / 高速缓存 cache file / 缓存文件 caching / 缓存 caching resolver / ...
- hiho #1361 Playfair密码表
题目1 : Playfair密码表 时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 小Hi和小Ho经常用Playfair密码表加密自己的代码. 密码表是按以下步骤生成的. ...
- C语言的执行
在ANSIC 的任何一种实现中,有两种不同的环境 翻译环境:将源代码转换为可执行的机器代码 执行环境:用于执行代码 这两种环境可以运行于同一个机器上,也可以运行于不同的机器上 例如交叉编译器:在一台机 ...
- JavaScript之函数
控制语句(switch) switch(name){ case '1': age = 123; break; case '2': age = 456; break; case '3': age = 7 ...
- Python自动化之sqlalchemy
如果该数 据库支持 自增列 ,则 SQLAlchemy 默认 自动 设定 表中第一个 类型 为整形 的主键 为自增列 ORM介绍 orm英文全称object relational mapping,就是 ...
- Discovering versions from the identity service failed when creating the password plugin.
If you are behind the proxy, then you have to set no_proxy environmental variable for your localhost ...
- jQuery FileUpload等插件的使用实例
1.jQuery FileUpload 需要的js: jquery.js jquery.fileupload.js jquery.iframe-transport.js jquery.xdr-tran ...
- splice 很好用
splice 类似一个 copy pos 和 delete的组合拳,用起来很方便. arrayObject.splice(index,howmany,item1,.....,itemX) // ind ...