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 ...
随机推荐
- 批处理快速更改ip地址
在各种网络中切换,windows更换ip地址步骤: 进入控制面板--网络和internet--网络和共享中心--理性适配器设置--然后找到网卡--进入属性--然后internet 协议--更改ip信 ...
- 关于百度地图api测距显示NaN的解决方案
因为随着百度地图的api的升级,测距的函数以及语句都发生的一定变化. 在调用api测距的时候通常我们使用的是语句map.getDistance(marker1,marker2); 但为什么这么简单的测 ...
- 研究kisso跨域登录的心得
kisso OA所有请求都跳转到这个接口,登录只有这一个入口 http://my.web.com:8090/oa/login.ht @RequestMapping("/login.ht&qu ...
- Android学习笔记(七)——常见控件
//此系列博文是<第一行Android代码>的学习笔记,如有错漏,欢迎指正! Android 给我们提供了大量的 UI控件,下面我们简单试试几种常用的控件. 一.TextView 在布局文 ...
- iOS 开发笔记 -- 各种细枝末节的知识(水滴石穿)
在此总结整理,遇到的各种的小问题: 1.通过从字典(数组)中取出的NSString的length==0 作为if的判断条件导致的carsh: 由于在字典中通过Key取出值之后直接做了length相关操 ...
- How to tile small texture image onto page as its background
You don’t need to set a big size image as the background of pages if the image is texture or uniform ...
- ndk学习7: 使用静态库
目录: 手工编译静态库 ndk-build编译静态库 手工编译静态库 老规矩还是先手工操作,知其然并知其所以然 需要用到的核心命令: gcc –g –c mod1.c mod2.c mod3. ...
- php preg_match($p, $str, $match)方法简介
方法作用:匹配指定的正则表达式并将结果放在$match数组中 代码示例: $p = '/name:([\\ws]+)/'; $str = "name:steven jobs"; p ...
- 在Navicat for MySQL中打开视图时,提示视图没有主键的问题
一直把视图理解为一个select语句而已,视图一般就是用于查询,不会通过视图来更新表或视图本身的数据,所以视图根本不需要什么主键.今天自己建了一个视图view_test: drop view if e ...
- linux 终端报错 Out of memory: Kill process[PID] [process name] score问题分析
从Out of memory来看是内存超出了,后面的 Kill process[PID] [process name] score好像和进程有关了,下面我们就一起来看看linux 终端报错 Out o ...