HDU1005Number Sequence(找规律)】的更多相关文章

Number Sequence Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 152357    Accepted Submission(s): 37087 Problem Description A number sequence is defined as follows: f(1) = 1, f(2) = 1, f(n) = (A…
Problem B Number Sequence Input: standard input Output: standard output Time Limit: 1 second 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…Sk. Each group Sk con…
传送门: http://acm.hdu.edu.cn/showproblem.php?pid=1005 Number Sequence Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 198316    Accepted Submission(s): 49744 Problem Description A number sequence…
解题心得: 1.对于数据很大,很可怕,不可能用常规手段算出最后的值在进行mod的时候,可以思考找规律. 2.找规律时不必用手算(我傻,用手算了好久).直接先找前100项进行mod打一个表出来,直接看就行了. 3.对于像斐波那契数列(本题)的那样,凭借肉眼无法找到规律的时候,可以观察本题的特点.那就是,第一项和第二项不会变,都为1,1.所以循环的时候必定是以1.1为开始,中间的数可以直接记录,很玄幻. 4.还是边界问题,这很重要,这时候数列尽量从1开始,因为在询问的时候都是询问的第n个数,要时刻保…
题目传送门 /* 找规律:看看前10项就能看出规律,打个表就行了.被lld坑了一次:( */ #include <cstdio> #include <algorithm> #include <iostream> #include <cstring> #include <cmath> #include <string> #include <vector> #include <queue> #include <…
C. Sequence (64 Mb, 1 sec / test)Integer sequences are very interesting mathematical objects. Let us examine a sequence generated with the use of two operations: doubling and “digit sorting”. The latter operation consists in ascending-order sort of t…
题目 第一次做是看了大牛的找规律结果,如下: //显然我看了答案,循环节点是48,但是为什么是48,据说是高手打表出来的 #include<stdio.h> int main() { ],a,b,i,n; f[]=;f[]=; while(scanf("%d%d%d",&a,&b,&n)!=EOF) { &&b==&&n==)break; ;i<;i++) { f[i]=(a*f[i-])%+(b*f[i-])%…
题意:定义 Fn 序列表示一串 <1 的分数,分数为最简分数,且分母 ≤n .问该序列的个数.(2≤N≤10^6) 解法:先暴力找规律(代码见屏蔽处),发现 Fn 序列的个数就是 Φ(1)~Φ(n) 的和.于是用欧拉筛预处理就好了. 注意--求前缀和要用 long long 的类型. 1 #include<cstdio> 2 #include<cstdlib> 3 #include<cstring> 4 #include<iostream> 5 usi…
Description Farmer John's N cows (1 <= N <= 100,000) are lined up in a row.Each cow is labeled with a number in the range 1...K (1 <= K <=10,000) identifying her breed. For example, a line of 14 cows might have these breeds: 1 5 3 2 5 1 3 4 4…
题目链接: http://codeforces.com/problemset/problem/353/D?mobile=true H. Queue time limit per test 1 secondmemory limit per test 256 megabytes 问题描述 There are n schoolchildren, boys and girls, lined up in the school canteen in front of the bun stall. The b…