ACM1005:Number Sequence】的更多相关文章

Problem Description A number sequence is defined as follows:f(1) = 1, f(2) = 1, f(n) = (A * f(n - 1) + B * f(n - 2)) mod 7.Given A, B, and n, you are to calculate the value of f(n).   Input The input consists of multiple test cases. Each test case co…
Problem Description A number sequence is defined as follows: f(1) = 1, f(2) = 1, f(n) = (A * f(n - 1) + B * f(n - 2)) mod 7. Given A, B, and n, you are to calculate the value of f(n).   Input The input consists of multiple test cases. Each test case…
解题心得: 1.对于数据很大,很可怕,不可能用常规手段算出最后的值在进行mod的时候,可以思考找规律. 2.找规律时不必用手算(我傻,用手算了好久).直接先找前100项进行mod打一个表出来,直接看就行了. 3.对于像斐波那契数列(本题)的那样,凭借肉眼无法找到规律的时候,可以观察本题的特点.那就是,第一项和第二项不会变,都为1,1.所以循环的时候必定是以1.1为开始,中间的数可以直接记录,很玄幻. 4.还是边界问题,这很重要,这时候数列尽量从1开始,因为在询问的时候都是询问的第n个数,要时刻保…
Number Sequence Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Problem Description Given two sequences of numbers : a[1], a[2], ...... , a[N], and b[1], b[2], ...... , b[M] (1 <= M <= 10000, 1 <= N <= 1000…
Number Sequence Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 36013   Accepted: 10409 Description A single positive integer i is given. Write a program to find the digit located in the position i in the sequence of number groups S1S2..…
Number Sequence Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 40388    Accepted Submission(s): 16659 Problem Description Given two sequences of numbers : a[1], a[2], ...... , a[N], and b[1],…
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5014 题目大意:给定数组 a[]={0,1,2......n} 求一个数组b[] 元素也为0.....n 但顺序与a[]不同 使得 sum(ai ^ bi)最大 注意到2^k =100000(k个0)  2^k-1 =11111(k个1) 那么 (2^k) ^ (2^k-1)=111111(k+1个1)等于 2^(k+1)-1  同样的有 (2^k+1) ^ (2^k-2)=2^(k+1)-1:…
Problem Description Given two sequences of numbers : a[1], a[2], ...... , a[N], and b[1], b[2], ...... , b[M] (1 <= M <= 10000, 1 <= N <= 1000000). Your task is to find a number K which make a[K] = b[1], a[K + 1] = b[2], ...... , a[K + M - 1]…
主题链接: pid=1005">huangjing 题意: 就是给了一个公式,然后求出第n项是多少... 思路: 题目中n的范围实在是太大,所以肯定直接递推肯定会超时,所以想到的是暴力打表,找循环节,可是也不是那么easy发现啊,所以这时候分析一下,由于最后都会mod7,所以总共同拥有7X7总情况,即A 0,1,2,3,4,5,6,7.B也是如此,所以循环节为49,这么这个问题就攻克了. .. 题目: Number Sequence Time Limit: 2000/1000 MS (Ja…
AX2012的number sequence framework中引入了两个Scope和segment两个概念,它们的具体作用从下面序列的例子说起. 法国/中国的法律要求财务凭证的Journal number包含公司代码和财务期间,比如这样的号码J-20-Jan11-000340,J表上Journal,20代表的是公司代码,Jan11为财务期间,000340才是系统生成的流水号. 在创建Numer sequence的界面上可以选择需要的Scope: Company and fiscal cale…