跳台階問題。一個台階總共有n 級,如果一次可以跳1 級,也可以跳2 級。求總共有多少總跳法,並分析演算法的時間複雜度。我們把n級台階時的跳法看成是n的函數,記為f(n)。當n>2時,第一次跳的時候就有兩種不同的選擇:一是第一次只跳1級,此時跳法數目等於後面剩下的n-1級台階的跳法數目,即為f(n-1);另外一種選擇是第一次跳2級,此時跳法數目等於後面剩下的n-2級台階的跳法數目,即為f(n-2)。因此n級台階時的不同跳法的總數f(n)=f(n-1)+(f-2)。long long
K Smallest SumsTime Limit: 1000MS Memory Limit: Unknown 64bit IO Format: %lld & %llu[Submit] [Go Back] [Status] DescriptionProblem KK Smallest SumsYou're given k arrays, each array has k integers. There are kk ways to pick exactly one
RMQ with ShiftsIn the traditional RMQ (Range Minimum Query) problem, we have a static array A. Then for each query (L, R)(LR), we report the minimum value among A[L], A[L + 1], ..., A[R]. Note that the indices start from 1, i.e. the left-most
Easy Problem from Rujia Liu?Time Limit: 1000MS Memory Limit: Unknown 64bit IO Format: %lld & %llu[Submit] [Go Back] [Status] DescriptionProblem EEasy Problem from Rujia Liu?Though Rujia Liu usually sets hard problems for contests (for
Problem II Can Guess the Data Structure!There is a bag-like data structure, supporting two operations:1 xThrow an element x into the bag.2Take out an element from the bag.Given a sequence of operations with return values, you're going to guess the
Fast Matrix OperationsTime Limit:5000MS Memory Limit:Unknown 64bit IO Format: %lld & %llu[Submit] [Go Back] [Status] DescriptionProblem FFast Matrix OperationsThere is a matrix containing at most 106 elements divided into r rows and c