hdu4291 A Short problem】的更多相关文章

A Short problem Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1716    Accepted Submission(s): 631 Problem Description According to a research, VIM users tend to have shorter fingers, compared…
Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 2383    Accepted Submission(s): 833 Problem Description According to a research, VIM users tend to have shorter fingers, compared with Emacs user…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4291 题目意思:求g(g(g(n))) mod 109 + 7,其中g(n) = 3g(n - 1) + g(n - 2),g(1) = 1,g(0) = 0. 思路:一个很简单的矩阵快速幂,简单的想法就是先用n算出g(n),然后再算g(g(n)),然后再算最外层,都是mod(1e9+7),这么做就错了,这道题有一个循环节的问题,看来这种嵌套的递推式取mod是存在循环节的,以后要注意下. 计算循环节…
A Short problem                                                          Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)                                                                                      Total Su…
HDU 4291 A Short problem(2012 ACM/ICPC Asia Regional Chengdu Online) 题目链接http://acm.hdu.edu.cn/showproblem.php?pid=4291 Description 给一个式子求结果.类似Fibonacci的公式g(n)=3*g(n-1)+g[n-2]. Input 给你n(1<=n<=1e18) Output 求g(g(g(n))) Sample Input 样例第一个就是0什么鬼,虽然没影响.…
A Short problem Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2711    Accepted Submission(s): 951 Problem Description According to a research, VIM users tend to have shorter fingers, compared…
题目链接:https://vjudge.net/problem/FZU-2013  Problem 2013 A short problem Accept: 356    Submit: 1083Time Limit: 1000 mSec    Memory Limit : 32768 KB  Problem Description The description of this problem is very short. Now give you a string(length N), an…
A Short problem Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2461    Accepted Submission(s): 864 Problem Description According to a research, VIM users tend to have shorter fingers, compared…
题目传送门 /* 题意:取长度不小于m的序列使得和最大 贪心:先来一个前缀和,只要长度不小于m,从m开始,更新起点k最小值和ans最大值 */ #include <cstdio> #include <algorithm> using namespace std; ; const int INF = 0x3f3f3f3f; int a[MAXN], sum[MAXN]; int main(void) //FZU 2013 A short problem { // freopen (&…
A Short problem Problem's Link Mean: 给定一个n,求:g(g(g(n))) % 1000000007 其中:g(n) = 3g(n - 1) + g(n - 2),g(1) = 1,g(0) = 0 analyse: 很经典的题.由于n特别大,直接求肯定不行.由于所有的模运算都会出现循环节,可以求出循环节. 由于模数是固定的,可以在本地暴力求出循环节. 对于1000000007,求得循环节为222222224: 对于222222224,求得循环节183120:…