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…
传送门: 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.a*b时的进位. 2.aa*b时加法时进位. 代码: #include <bits\stdc++.h> using namespace std; ]; int main(){ int a,b,d,n,t; cin >> t; while(t--){ cin >> a >> b >> d >> n; memset(num,,sizeof(num)); ){ int t = n; ;…
[题目要求] 请仔细查看如下几个数字的规律,并使用shell脚本输出后面的十个数字 10 31 53 77 105 141... ... [核心要点] 计算两个数值之间的差值 [脚本] #!/bin/bash x= y= ` do echo $x x=$[$y+$y] z=$[**$i] y=$[$y+$z] done…
题目链接 Problem Description Consider the aggregate An= { 1, 2, -, n }. For example, A1={1}, A3={1,2,3}. A subset sequence is defined as a array of a non-empty subset. Sort all the subset sequece of An in lexicography order. Your task is to find the m-th…
链接:传送门 题意:略 思路:f(n) = (A * f(n - 1) + B * f(n - 2)) mod 7 -> f(n) = (A * f(n-1)%7 + B * f(n-1)%7)%7 检查输出可以发现规律,每48个数一循环,因此只需要打出前50个数的fib表然后对n%7即可. /************************************************************************* > File Name: 1.cpp > Aut…
剑指 Offer 44. 数字序列中某一位的数字 Offer_44 题目描述 题解分析 java代码 package com.walegarrett.offer; /** * @Author WaleGarrett * @Date 2021/2/8 10:01 */ /** * 题目描述: * 数字以0123456789101112131415-的格式序列化到一个字符序列中.在这个序列中,第5位(从下标0开始计数)是5,第13位是1,第19位是4,等等. * 请写一个函数,求任意第n位对应的数字…
题目描述 $T$组数据,每次给定$n$,请求出下式的值,对$10^9+7$取模: $$C_n^0\times C_n^0+C_n^1\times C_n^1+C_n^2\times C_n^2+...+C_n^n\times C_n^n$$ 输入格式 第一行一个整数$T$,表示数据组数.接下来$T$行,每一行包含一个整数$n$,含义如题所示. 输出格式 输出$T$行,每行包含一个整数,表示对$10^9+7$取模后的答案. 样例 样例输入: 212 样例输出: 26 数据范围与提示 对于$30\%…
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…
解题心得: 1.对于数据很大,很可怕,不可能用常规手段算出最后的值在进行mod的时候,可以思考找规律. 2.找规律时不必用手算(我傻,用手算了好久).直接先找前100项进行mod打一个表出来,直接看就行了. 3.对于像斐波那契数列(本题)的那样,凭借肉眼无法找到规律的时候,可以观察本题的特点.那就是,第一项和第二项不会变,都为1,1.所以循环的时候必定是以1.1为开始,中间的数可以直接记录,很玄幻. 4.还是边界问题,这很重要,这时候数列尽量从1开始,因为在询问的时候都是询问的第n个数,要时刻保…