hdoj5793 A Boring Question【找规律】】的更多相关文章

A Boring Question Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 865    Accepted Submission(s): 534 Problem Description There are an equation.∑0≤k1,k2,⋯km≤n∏1⩽j<m(kj+1kj)%1000000007=?We define…
找出的规律.... 1 2 3 2 2 7 3 2 15 4 2 31 5 2 63 1 3 4 2 3 13 3 3 40 4 3 121 5 3 361 然后我们来推个公式: 比如说a2=3a1+1, 我们可以看到 等比是m, 然后凑一下, 1+x=m*x x=1/(m-1) 上面那个例子就凑成了这个样子, (a2+1/2)/(a1+1/2)=3 所以首项是:m+1+[1/(m-1)] 第n项是:[m+1+1/(m-1)]*m^(n-1) 答案是:[m+1+1/(m-1)]*m^(n-1)-…
题目链接:hdu_5793_A Boring Question 题意: 自己看吧,说不清楚了. 题解: 打表找规律 #include<cstdio> typedef long long ll; ; ll pow(ll a,ll b) { ll an=; while(b){ )an=(an*a)%mod; b>>=,a=(a*a)%mod; } return an; } int main(){ int t,n,m; scanf("%d",&t); whil…
A Boring Question 题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5793 Description Input The first line of the input contains the only integer T, Then T lines follow,the i-th line contains two integers n,m. Output For each n and m,output the answer i…
参考博客:http://www.cnblogs.com/Sunshine-tcf/p/5737627.html. 说实话,官方博客的推导公式看不懂...只能按照别人一样打表找规律了...但是打表以后其实也不是很好看出规律的...而且这个表都写了半天233...(真是太弱了= =)为了打表,我们应当先知道k数列必须是不递减的才能满足值不为0,因此我们可以用递归来写这个表(类似于dfs). AC代码如下: #include <stdio.h> #include <algorithm>…
A Boring Question Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 487    Accepted Submission(s): 271 Problem Description There are an equation.∑0≤k1,k2,⋯km≤n∏1⩽j<m(kj+1kj)%1000000007=? We define…
Couple doubi 题目链接: http://acm.hust.edu.cn/vjudge/contest/121334#problem/D Description DouBiXp has a girlfriend named DouBiNan.One day they felt very boring and decided to play some games. The rule of this game is as following. There are k balls on th…
Couple doubi Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status Practice HDU 4861 Description DouBiXp has a girlfriend named DouBiNan.One day they felt very boring and decided to play some games. The rule of th…
Birthday Toy Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 644    Accepted Submission(s): 326 Problem Description AekdyCoin loves toys. It is AekdyCoin’s Birthday today and he gets a special “…
原题链接:http://acm.hdu.edu.cn/showproblem.php?pid=4349 Xiao Ming's Hope Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1723    Accepted Submission(s): 1144 Problem Description Xiao Ming likes coun…